結果

問題 No.138 化石のバージョン
ユーザー mell1mell1
提出日時 2018-11-28 10:24:17
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 374 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 53,336 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 08:40:02
合計ジャッジ時間 1,603 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d.%d.%d%d.%d.%d",a,a+1,a+2,b,b+1,b+2);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>
using namespace std;
int main(void){
    int a[3],b[3],i=0;
    bool c=false;
    scanf("%d.%d.%d%d.%d.%d",a,a+1,a+2,b,b+1,b+2);
    if(a[i]>b[i]){
        c=true;
    }else if(a[i]==b[i]){
        i++;
        if(a[i]>b[i]) c=true;
        else if(a[i]==b[i]&&a[i+1]>=b[i+1]) c=true;
    }
    if(c) cout<<"YES\n";
    else cout<<"NO\n";
    return 0;
}
0