結果
| 問題 |
No.653 E869120 and Lucky Numbers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-23 23:06:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 969 bytes |
| コンパイル時間 | 524 ms |
| コンパイル使用メモリ | 54,872 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-24 10:50:01 |
| 合計ジャッジ時間 | 1,380 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 WA * 3 |
コンパイルメッセージ
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));
bool only = true;
for(int i=0;i<strlen(p);i++){
if(p[i]-'0'!=6 && p[i]-'0'!=7){
only = false;
}
}
if(only){
printf("No\n");
return 0;
}
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;
}