AOJ 195

  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
#include <stdio.h>
#include <stdlib.h>
 
#define LINE_BUF_SIZE 1024
 
int main(void){
    // Your code here!
    static char line[LINE_BUF_SIZE];
    
    while(fgets(line, sizeof(line), stdin) != NULL) {
        int a, b;
        sscanf(line, "%d %d", &a, &b);
        if(a == 0 && b == 0) {
            break;
        }
        
        int ans1 = 0;
        int ans2 = a + b;
        int i;
        
        for(i = 1; i < 5; i++) {
            fgets(line, sizeof(line), stdin);
            sscanf(line, "%d %d", &a, &b);
            if(ans2 < a + b) {
                ans2 = a + b;
                ans1 = i;
            }
        }
        
        char c = ans1 + 'A';
        printf("%c %d\n", c, ans2);
    }
    return 0;
}

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS