//重发一下
```cpp
#include<bits/stdc++.h>
using namespace std;
int t[1000],t2[1000];
bool ft[1000]={false};
int n;
int finde(int el)
{
int i;
for(i=0;i<n;i++)
{
if(t2[i]==el&&ft[i]==false)
{
ft[i]=true;
return i;
}
}
return 2147483646;
}
int main()
{
cin >> n;
int i,j,min,mini;
int totaltime=0;
for(i=0;i<n;i++)
{
cin >> t[i];
t2[i]=t[i];
}
sort(t,t+n);
for(i=0;i<n;i++)
{
cout << finde(t[i]) + 1 << " ";
totaltime= totaltime+ (n-1-i) * t[i];
}
cout << endl;
double ans= totaltime / n;
printf("%0.2lf",ans);
return 0;
}
```
by howtolearn @ 2018-10-04 20:19:34
## 改了一下,还是不全对怎么回事!
```cpp
#include<bits/stdc++.h>
using namespace std;
int t[1000],t2[1000];
bool ft[1000]={false};
int n;
int finde(int el)
{
int i;
for(i=0;i<n;i++)
{
// cout << t2[i]<< endl;
if(t2[i]==el&&ft[i]==false)
{
ft[i]=true;
return i;
}
}
// cout << n << " " << endl;
return 2147483646;
}
int main()
{
cin >> n;
if(n==0)
{
cout << 0;
return 0;
}
int i,j,min,mini;
int totaltime=0;
for(i=0;i<n;i++)
{
cin >> t[i];
t2[i]=t[i];
}
sort(t,t+n);
for(i=0;i<n;i++)
{
cout << finde(t[i]) + 1 << " ";
totaltime= totaltime+ (n-1-i) * t[i];
}
cout << endl;
double ans;
ans = totaltime / double(n);
printf("%0.2lf",ans);
return 0;
}
```
by howtolearn @ 2018-10-04 21:31:59
@[howtolearn](/space/show?uid=35168)
你的0保留两位小数点呢??
by 迷残云 @ 2018-10-17 22:21:43
根本不需要这么麻烦
by 迷残云 @ 2018-10-17 22:23:15
@[ZDD0516](/space/show?uid=46354)
emmm
什么意思
by howtolearn @ 2018-10-18 07:05:21