|
|
вернуться в форумI really can't understand why I got WA1. Here is my code. Please help me anybody. Послано prof 29 апр 2005 11:13 #include <stdlib.h> #include <stdio.h> #include <iostream.h> long res[101]; struct p { long id; int m; }; int main() {
long n; cin>>n; p* mas =new p[n]; for (long h =0;h<n;h++)
cin>>mas[h].id>>mas[h].m; for (int j=0;j<=102;j++) res[j]=0; long kol=0; for (long h=0;h<n;h++) res [mas[h].m]++; int j; for (j=100;j>=0;j--) if (res[j]) break; int y=1; for (int k=j;k>=0;k--) { if (res [k]) { for (long y=0;y<n;y++) if (mas[y].m==k) { printf("%ld ",mas[y].id); cout<<k<<endl ; res[k]--; if (res[k]==0) break; } } } delete [] mas; return 0; } |
|
|