結果
問題 |
No.138 化石のバージョン
|
ユーザー |
|
提出日時 | 2018-07-25 23:00:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 528 bytes |
コンパイル時間 | 457 ms |
コンパイル使用メモリ | 54,708 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 05:47:39 |
合計ジャッジ時間 | 1,442 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d.%d.%d",&old_ver[0],&old_ver[1],&old_ver[2]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d.%d.%d",&chk_ver[0],&chk_ver[1],&chk_ver[2]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<iostream> using namespace std; int main() { int old_ver[3],chk_ver[3]; old_ver[0] = 35; scanf("%d.%d.%d",&old_ver[0],&old_ver[1],&old_ver[2]); scanf("%d.%d.%d",&chk_ver[0],&chk_ver[1],&chk_ver[2]); for(int i=0;i<3;i++){ if(old_ver[i]<chk_ver[i]){ cout<<"NO"<<endl; break; } else if(old_ver[i]>chk_ver[i]){ cout<<"YES"<<endl; break; } else if(i !=2)continue; else cout<<"YES"<<endl; } return 0; }