UVa : 12015 (Google is Feeling Lucky)



// http://uva.onlinejudge.org/external/120/12015.html
// runtime: 0.008s
// tag: adhoc 

#include <cstdio>
#include <algorithm>

using namespace std;

int main ()
{
	int testCases; scanf ("%d", &testCases);
	int cases = 0;

	char urls [10 + 2] [100 + 10];
	int rels [10 + 2];

	while ( testCases-- ) {

		int maxi = -1;

		for ( int i = 0; i < 10; i++ ) {
			scanf ("%s %d", urls [i], &rels [i]);
			maxi = max (maxi, rels [i]);
		}

		printf ("Case #%d:\n", ++cases);

		for ( int i = 0; i < 10; i++ ) {
			if ( maxi == rels [i] ) printf ("%s\n", urls [i]);
		}
	}

	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