結果

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

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	int A[3], B[3];
	scanf("%d.%d.%d", &A[0], &A[1], &A[2]);
	scanf("%d.%d.%d", &B[0], &B[1], &B[2]);
	
	string str = "YES";
	for (int i = 0; i < 3; i++)
	{
		if (A[i] < B[i])
		{
			str = "NO";
			break;
		}
		else if (A[i] > B[i])
		{
			break;
		}
	}
	cout << str << endl;

	return 0;
}
0