Timus : 1263 (Elections)



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

#include <stdio.h>

int main(int argc, char *argv[])
{
	int n, m; scanf ("%d %d", &n, &m);
	double vote_frq [10000 + 5];

	for ( int i = 0; i < 10005; i++ )
	{
		vote_frq [i] = 0;
	}

	int total_voter = m;

	while ( m-- )
	{
		int num; scanf ("%d", &num);
		vote_frq [num]++;
	}

	for ( int i = 1; i <= n; i++ )
	{
		printf ("%.2lf%%\n", (vote_frq [i] / total_voter ) * 100.0);
	}
	
	return 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s