結果

問題 No.201 yukicoderじゃんけん
ユーザー arrows
提出日時 2017-01-21 02:43:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 580 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 64,768 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 04:11:08
合計ジャッジ時間 1,335 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int c(string a, string b)
{
    int n = a.size(), m = b.size();
    if (n < m) return 1;
    if (n > m) return -1;

    for (int i = 0; i < n; i++) {
        if (a[i] < b[i]) return 1;
        if (a[i] > b[i]) return -1;
    }
    return 0;
}

int main()
{
    string SA, PA, XA, SB, PB, XB;
    cin >> SA >> PA >> XA >> SB >> PB >> XB;
    int res = c(PA, PB);
    if (res == 1) {
        cout << SB << endl;
    } else if (res == -1) {
        cout << SA << endl;
    } else {
        cout << -1 << endl;
    }        
    return 0;
}
0