Introduction

This is my blog of programming, I take notes and leave codes of computer science problems I solved here. Be my guest to comment :)

Monday, December 3, 2012

uva 12015 - Google is Feeling Lucky


/*
Problem link
*/
#include <iostream>
#include <cstdio>
using namespace std;
const int n = 20;

class url {
public:
 string link;
 int value;
};

url a[n];

int main() {
 int ntest;
 string line;
 cin >> ntest;
 for (int test=1; test<=ntest; test++)
 {
  printf("Case #%d:\n",test);
  for (int i=1; i<=10; i++) 
  {
   cin >> a[i].link;
   cin >> a[i].value;
  }
  int themax = 0;
  for (int i=1; i<=n; i++) themax = a[i].value>themax ? a[i].value : themax;
  for (int i =1; i<=n; i++)
   if (a[i].value==themax) cout << a[i].link << endl;
 } 
 return 0;
}

No comments:

Post a Comment