結果

問題 No.653 E869120 and Lucky Numbers
ユーザー e869120e869120
提出日時 2017-12-27 20:13:34
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,116 bytes
コンパイル時間 485 ms
コンパイル使用メモリ 64,748 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-11 19:22:38
合計ジャッジ時間 2,321 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 1 ms
4,352 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 1 ms
4,352 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,352 KB
testcase_21 AC 1 ms
4,352 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 1 ms
4,352 KB
testcase_26 AC 1 ms
4,348 KB
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,352 KB
testcase_30 AC 3 ms
4,348 KB
testcase_31 AC 1 ms
4,352 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 2 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;
string S; bool I = false; int cx = 0;
int main() {
	cin >> S; if (S[0] == '1') { I = true; cx = 1; }
	if (S[0] == '2' || S[0] == '3' || S[0] == '4' || S[0] == '5' || S[0] == '9') { cout << "No" << endl; return 0; }
	for (int i = cx; i < (int)S.size() - 1; i++) {
		if (I == false) {
			if (S[i] == '7')continue;
			if (S[i] == '6') {
				if (i == S.size() - 1)continue;
				if (S[i + 1] == '6' || S[i + 1] == '7' || S[i + 1] == '8')continue;
				cout << "No" << endl; return 0;
			}
			if (S[i] == '8') {
				if (i == S.size() - 1)continue;
				if (S[i + 1] == '3' || S[i + 1] == '4' || S[i + 1] == '5') { continue; }
				cout << "No" << endl; return 0;
			}
			if (S[i] == '3' || S[i] == '4' || S[i] == '5') { I = true; }
			else { cout << "No" << endl; return 0; }
		}
		if (I == true) {
			if (S[i] == '3' || S[i] == '4' || S[i] == '5') { continue; }
			else { cout << "No" << endl; return 0; }
		}
	}
	if (S[S.size() - 1] == '2' || S[S.size() - 1] == '3' || S[S.size() - 1] == '4') { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}
0