結果

問題 No.201 yukicoderじゃんけん
ユーザー suibaka_ku
提出日時 2017-03-12 03:57:56
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 712 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 75,528 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 02:39:40
合計ジャッジ時間 1,598 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
using ll = long long;

string solve(string const& sa, string const& sb, string const& pa, string const& pb) {
    if(pa.size() < pb.size()) {
        return sb;
    } else if(pa.size() > pb.size()) {
        return sa;
    } else {
        for(int i=0; i<pa.size(); ++i) {
            if(pa[i] < pb[i]) {
                return sb;
            } else if(pa[i] > pb[i]) {
                return sa;
            }
        }
    }
    return "-1";
}

int main() {
    string sa, sb, pa, pb, xa, xb;
    cin >> sa >> pa >> xa;
    cin >> sb >> pb >> xb;
    cout << solve(sa, sb, pa, pb) << endl;
}
0