下载来的测试点也会过啊,迷-_-||
求神犇救命
by ReActor @ 2018-07-09 19:53:03
请不要怀疑上千人过的题目的数据问题
by d3NtMDAw @ 2018-07-09 19:56:07
@[ReActor](/space/show?uid=104724) 关掉freopen
by moye到碗里来 @ 2018-07-09 19:58:59
@[moye到碗里来](/space/show?uid=52576) 他这题得到了73分诶。
by d3NtMDAw @ 2018-07-09 20:09:04
@[wsm000](/space/show?uid=32196) 纳不知道了阿。。
by moye到碗里来 @ 2018-07-09 20:11:33
```cpp
#include<bits/stdc++.h>
using namespace std;
#define N 100000
struct water{
int r,x;
}a[N];
bool cmp(const water a,const water b){
if(a.x<b.x) return 1;
return 0;
}
int main()
{
int n,m;register int i,j;double sum=0;
scanf("%d",&n);
for(i=1;i<=n;++i){
scanf("%d",&a[i].x);a[i].r=i;
}
sort(a+1,a+1+n,cmp);
for(i=1;i<=n;++i){
printf("%d ",a[i].r);
sum+=a[i].x*(n-i);
}
printf("\n%.2f",(sum*1.0)/n);
return 0;
}
```
已经ac了,一个是浮点精度问题,另一个是要按输入顺序排序,所以cmp比较a[i].x得是<而不是<=
by d3NtMDAw @ 2018-07-09 22:23:43
@[wsm000](/space/show?uid=32196) 感人!谢谢前辈~~~
by ReActor @ 2018-07-11 20:02:11
@[ReActor](/space/show?uid=104724) 请叫我菜鸡,谢谢
by d3NtMDAw @ 2018-07-12 13:46:13