4 条题解
-
0
#include #include using namespace std; struct pdjs{ double time; int id; }arr[1005]; bool cmp(pdjs a,pdjs b){ if(a.time!=b.time) return a.time<b.time; else return a.id<b.id; } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>arr[i].time; arr[i].id=i; } sort(arr+1,arr+n+1,cmp); for(int i=1;i<=n;i++) cout<<arr[i].id<<" "; cout<<endl; double brr[1005]={0},sum=0; for(int i=1;i<n;i++){ brr[i]= brr[i-1]+arr[i].time; sum+=brr[i]; } printf("%.2lf",sum/n); return 0; }
-
0
#include <bits/stdc++.h>
using namespace std;
struct pdjs{
- double time; int id; }arr[1005]; bool cmp(pdjs a,pdjs b){ if(a.time!=b.time) return a.time<b.time; else{ return a.id<b.id; } } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>arr[i].time; arr[i].id=i; } sort(arr+1,arr+n+1,cmp); for(int i=1;i<=n;i++){ cout<<arr[i].id<<" "; } cout<<endl; double brr[1005]={0},sum=0; for(int i=1;i<n;i++){ brr[i]=brr[i-1]+arr[i].time; sum+=brr[i];
} printf("%.2lf",sum/n); return 0;
}
-
0
#include <bits/stdc++.h> using namespace std; struct pdjs{ double time; int id; }arr[1005]; bool cmp(pdjs a,pdjs b){ if(a.time!=b.time) return a.time<b.time; else{ return a.id<b.id; } } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>arr[i].time; arr[i].id=i; } sort(arr+1,arr+n+1,cmp); for(int i=1;i<=n;i++){ cout<<arr[i].id<<" "; } cout<<endl; double brr[1005]={0},sum=0; for(int i=1;i<n;i++){ brr[i]=brr[i-1]+arr[i].time; sum+=brr[i];
} printf("%.2lf",sum/n); return 0;
}
-
0
#include <bits/stdc++.h> using namespace std; struct pdjs{ double time; int id; }arr[1005]; bool cmp(pdjs a,pdjs b){ if(a.time!=b.time) return a.time<b.time; else{ return a.id<b.id; } } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>arr[i].time; arr[i].id=i; } sort(arr+1,arr+n+1,cmp); for(int i=1;i<=n;i++){ cout<<arr[i].id<<" "; } cout<<endl; double brr[1005]={0},sum=0; for(int i=1;i<n;i++){ brr[i]=brr[i-1]+arr[i].time; sum+=brr[i];
} printf("%.2lf",sum/n); return 0;
}
- 1
信息
- ID
- 433
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 7
- 标签
- 递交数
- 57
- 已通过
- 14
- 上传者