|
|
вернуться в форумWA#1 whats wrong with my code? i'd check it but i'v got WA#1 #include <stdio.h> #include <string.h> /* //---------------------------------------------------------------------- void sort(int* in,int a,int b) { int i,j,mode; if(a>=b)return; for(i=a, j=b, mode=1 ; i < j ; mode > 0 ? j--: i++) { if(in[i]>in[j]) { int c=in[i]; in[i]=in[j]; in[j]=c; mode=-mode; } } sort(in,a,i-1); sort(in,i+1,b); } //---------------------------------------------------------------------- int main(int argc, char* argv[]) { int *mass,size_s,size_c,counter=1; float percent; scanf("%d",&size_c); scanf("%d",&size_s); mass=new int[size_s]; for(int i=0;i<size_s;i++)scanf("%d",&mass[i]); sort(mass,0,size_s); for(int i=0;i<size_s;i++,counter++) { if(mass[i]!=mass[i+1]||i==size_s-1) { printf("%.2f%%\n",(float)100*counter/size_s); counter=0; } } return 0; } Re: WA#1 Послано Madhav 13 июн 2008 12:54 got accepted :). Edited by author 13.06.2008 12:57 |
|
|