結果
問題 | No.653 E869120 and Lucky Numbers |
ユーザー |
![]() |
提出日時 | 2018-02-24 10:38:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 802 bytes |
コンパイル時間 | 646 ms |
コンパイル使用メモリ | 57,920 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 18:18:08 |
合計ジャッジ時間 | 1,499 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
ソースコード
#include <iostream> #include <algorithm> #include <string> using namespace std; string s; int to_n(char c) { return c - '0'; } int main() { cin >> s; reverse(s.begin(),s.end()); // 6 + 6 , 6 + 7 , 7 + 7 if(2 <= to_n(s[0]) && to_n(s[0]) <= 4) { } else { cout << "No" << endl; return 0; } int i = 1; for(;i < s.size();i++) { if(3 <= to_n(s[i]) && to_n(s[i]) <= 5) { } else { break; } } if(i == s.size() - 1 && (1 == to_n(s[i]))) { cout << "Yes" << endl; return 0; } if(i < s.size() && (7 == to_n(s[i]) || 8 == to_n(s[i]))) { i++; for(;i < s.size();i++) { if(6<= to_n(s[i]) && to_n(s[i]) <= 7) { } else { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; } cout << "No" << endl; return 0; }