题意描述不清 而且还卡精度 ~~
#include#include #include using namespace std;int a[110];int main(){ int n, sum = 0; scanf("%d", &n); for(int i = 0; i < n; i ++) { scanf("%d", &a[i]); sum += a[i]; } double k = (double)sum/(n+1), sum2 = 0; for(int i = 0; i < n; i ++) { if((double)a[i] > k) sum2 += (double)a[i]-k; } for(int i = 0; i < n; i ++) { if(i) putchar(' '); if((double)a[i] > k) printf("%d", (int)(((double)a[i]-k)/sum2*100+0.00001)); else printf("0"); } return 0;}