結果
| 問題 |
No.653 E869120 and Lucky Numbers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-23 23:02:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 816 bytes |
| コンパイル時間 | 879 ms |
| コンパイル使用メモリ | 52,992 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-10 02:04:31 |
| 合計ジャッジ時間 | 1,696 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 4 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
19 | scanf("%s", p);
| ~~~~~^~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
//typedef pair<int,int> P;
int main(){
char p[20000+1];
scanf("%s", p);
reverse(p,p+strlen(p));
int carry = 0;
for(int i=0;i<strlen(p)-1;i++){
if((carry+6+6)%10 == p[i]-'0') carry = 1;
else if((carry+6+7)%10 == p[i]-'0') carry = 1;
else if((carry+7+7)%10 == p[i]-'0') carry = 1;
else if((carry+6)%10 == p[i]-'0') carry = 0;
else if((carry+7)%10 == p[i]-'0') carry = 0;
else{
printf("No\n");
return 0;
}
}
if(carry==p[strlen(p)-1]-'0'){
printf("Yes\n");
}else if(carry+6==p[strlen(p)-1]-'0'){
printf("Yes\n");
}else if(carry+7==p[strlen(p)-1]-'0'){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
}