寝癖頭の解法

学習中の覚え書きを投稿、更新していきます。

Aizu Online Judge in C++ #Volume1 - 0195 : What is the Most Popular Shop in Tokaichi?

Aizu Online Judge(AOJ)の過去問から、その提出コードの解答例です。

・問題 "What is the Most Popular Shop in Tokaichi?"
https://onlinejudge.u-aizu.ac.jp/problems/0195
・人気の出店は?
僕が作成、提出したコードは、以下のとおりです。

・Aizu Online Judge in C++ #Volume1 - 0195 : What is the Most Popular Shop in Tokaichi?
/*
Aizu Online Judge in C++ #Volume1 - 0195 : What is the Most Popular Shop in Tokaichi?
 https://onlinejudge.u-aizu.ac.jp/problems/0195
 提出コードの解答例
 https://neguse-atama.hatenablog.com
*/
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
    ll s,s1,s2,shop;
    while(cin>>s1>>s2,s1){
        s=s1+s2;
        shop=0;
        for(ll i=1;i<5;i++){
            cin>>s1>>s2;
            if(s<s1+s2){
                s=s1+s2;
                shop=i;
            }
        }
        cout<<(char)(shop+65)<<" "<<s<<endl;
    }
    return 0;
}

設問の出典は、プログラミング問題のオンライン採点システム「Aizu Online Judge(AOJ)」です。
http://judge.u-aizu.ac.jp/onlinejudge/