結果
| 問題 | 
                            No.201 yukicoderじゃんけん
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-09-08 16:59:42 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 479 bytes | 
| コンパイル時間 | 609 ms | 
| コンパイル使用メモリ | 65,024 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-27 15:04:18 | 
| 合計ジャッジ時間 | 1,504 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 | 
コンパイルメッセージ
main.cpp: In function 'bool f(std::string, std::string)':
main.cpp:11:1: warning: control reaches end of non-void function [-Wreturn-type]
   11 | }
      | ^
            
            ソースコード
#include<iostream>
using namespace std;
bool f(string s, string t){
    if(s.length() < t.length()) return true;
    if(s.length() > t.length()) return false;
    for(int i = 0; i < s.length(); i++){
        if(s[i] == t[i])    continue;
        return s[i] < t[i];
    }
}
int main(){
    string a, b, pa, pb, x;
    cin >> a >> pa >> x >> b >> pb >> x;
    if(pa == pb){
        cout << -1 << endl;
    }else{
        cout << (f(pa,pb) ? b : a) << endl;
    }
    return 0;
}