結果

問題 No.653 E869120 and Lucky Numbers
ユーザー kotamanegi
提出日時 2018-02-23 22:47:12
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,472 bytes
コンパイル時間 800 ms
コンパイル使用メモリ 88,312 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-09 20:13:21
合計ジャッジ時間 1,826 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
#define EVAL 1
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 1048576
#define PI 3.1415926535
int main() {
	string s;
	cin >> s;
	if (s == "0") {
		cout << "No" << endl;
		return 0;
	}
	int foo = 0;
	for (int i = 0;i < s.length();++i) {
		if (s[i] != '6'&&s[i] != '7') foo = 1;
	}
	if (foo == 0) {
		cout << "No" << endl;
		return 0;
	}
	int kuriagari = 0;
	for (int i = s.length() - 1;i >= 0;--i) {
		int poo = s[i] - '0';
		poo -= kuriagari;
		kuriagari = 0;
		poo %= 10;
		if (poo == 6 || poo == 7) {
			kuriagari = 0;
		}
		else {
			if (poo == 2 || poo == 3 || poo == 4) {
				kuriagari = 1;
			}
			else if(poo != 0){
				cout << "No" << endl;
				return 0;
			}
		}
	}
	if (kuriagari == 0) {
		cout << "Yes" << endl;
		return 0;
	}
	else {
		cout << "No" << endl;
		return 0;
	}
}
0