http://acm.timus.ru/problem.aspx?space=1&num=1263

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "stdafx.h"
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define FOR(i,a,b) for (int i=a; i<b; i++)
#define FO(i,n) FOR(i,0,n)
#define max(a,b) (a>b?a:b)
#define pb push_back
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int N,M ,x;
cin>>N>>M;
int *a=new int[N+1];
memset(a,0,(N+1)*sizeof(int));
for (int i=0; i<M; i++)
{
cin>>x;
a[x-1]++;
}
for (int i=0; i<N; i++)
{
printf("%.2f",100*(double)a[i]/M);
cout<<"%\n";
}
}