I - iCow POJ - 3665

xiaoxiao2021-02-28  133

I - iCow

  POJ - 3665  src="https://vjudge.net/problem/description/6875?1493399564000" width="100%" height="1258px" frameborder="0" scrolling="no" style="box-sizing: inherit;"> #include <iostream> #include <algorithm> #include <map> using namespace std; int main() { int n,T; while(cin>>n>>T){ int a[1000+5]; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<T;i++){ if(n==1) while(T--) cout<<1<<endl; else{ int max=-100,maxx; for(int j=0;j<n;j++){ if(a[j]>max){ max=a[j]; maxx=j; } } cout<<maxx+1<<endl; int add=max/(n-1); int left=max%(n-1); a[maxx]=0; max=-1; for(int k=0;k<n;k++) { if(k==maxx) continue; if(left){ left--; a[k]++; } a[k]+=add; } } } } return 0; }

转载请注明原文地址: https://www.6miu.com/read-42004.html

最新回复(0)