結果

問題 No.138 化石のバージョン
ユーザー ikd
提出日時 2015-11-01 22:25:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 761 bytes
コンパイル時間 492 ms
コンパイル使用メモリ 60,444 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 13:36:36
合計ジャッジ時間 1,537 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |     scanf("%d.%d.%d", &x[0], &x[1], &x[2]);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     scanf("%d.%d.%d", &y[0], &y[1], &y[2]);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>

using namespace std;

int main(){

    int x[3], y[3];

    scanf("%d.%d.%d", &x[0], &x[1], &x[2]);
    scanf("%d.%d.%d", &y[0], &y[1], &y[2]);

    bool flag = true;
    if(x[0]<y[0]){
        flag = false;
    }else if(x[0]>y[0]){
        flag = true;
    }else{
        if(x[1]<y[1]){
            flag = false;
        }else if(x[1]>y[1]){
            flag = true;
        }else{
            if(x[2]<y[2]){
                flag = false;
            }else if(x[2]>y[2]){
                flag = true;
            }else{
                flag = true;
            }
        }
    }

    if(flag){
        cout<< "YES"<< endl;
    }else{
        cout<< "NO"<< endl;
    }

    return 0;
}
0