|
|
Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | No subject | Ghirinovski | 1263. Выборы | 28 июн 2007 14:36 | 1 | #include<stdio.h> int main() { long int i,n,m,x; scanf("%d", &n); scanf("%d", &m); int a[20000]={0}; for(i=1;i<=m;i++) {scanf("%ld", &x);a[x]++; } for(i=1;i<=n;i++) { printf("%.2f%%\n",(double)((double)a[i]*100/(double)m)); } return 0; } | if 3 person hove 2 vote/person | yingyong | 1263. Выборы | 15 янв 2007 13:45 | 3 | Ex: 3 6 1 1 2 2 3 3 output 33.33% 33.33% 33.33% /*it not 100.00% it have 99.99%/ it is Ok! problem says that u should print to within 2 decimals, it doesn't say us that the sum of data's be exactly 100%! ByE!! Edited by author 15.01.2007 13:47 | pascal program!!! | luke415 | 1263. Выборы | 11 авг 2005 06:25 | 7 | program cl; var n,m,i,j:integer; l:array[1..10000]of integer; a:real; begin readln(n,m); for i:=1 to m do begin readln(j); inc(l[j]); end; for i:=1 to n do begin a:=l[i]/m*100; writeln(a:4:2,'%'); end; end. My program have on test 0.062cek and 457 КБ. Var N,M,i,N0:longint; S:real; A:array[1..10000] of real; Begin Read(N); Readln(M); S:=100/m; fillchar(A,sizeof(A),0); For i:=1 to m do begin Readln(N0); A[N0]:=A[N0]+S; end; For i:=1 to N do Writeln(A[i]:0:2,'%'); End. I have 0,046 var arr:array[1..10000] of integer; a:real; i,n,m,tm:integer; begin {for i:=1 to 10000 do arr[i]:=0;} read(n,m); for i:=1 to m do begin read(tm); inc(arr[tm]); end; a:=m; for i:=1 to n do writeln(arr[i]/a*100:0:2,'%') end. daaaaaaa!!!!!!!! It is not possible!!! What ingenious decision!!! |
|
|
|