問題
https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/9/ITP1_9_C (新しいタブで開く)
問題文
太郎と花子がカードゲームをする。
それぞれ 枚のカードを持っていて、 ターン勝負する。
各ターンでは 1 枚ずつカードを出し、辞書順で大きい方が勝ち。
勝者には 3 ポイント、引き分けは 1 ポイントずつ加算される。
ゲーム終了後における、太郎と花子のポイントを出力してね。
制約
- は英小文字からなる
サンプル
I/O 1
3 cat dog fish fish lion tiger
1 7
考察
やるだけ。
コード
int main() { int n; cin >> n; int a = 0, b = 0; rep(_, n) { string s, t; cin >> s >> t; if (s < t) b += 3; else if (s > t) a += 3; else ++a, ++b; } printf("%d %d\n", a, b); return 0; }