CF110A.Nearly Lucky Number
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky digits in it is a lucky number. He wonders whether number n is a nearly lucky number.
佩佳喜欢幸运数。众所周知,幸运数是指十进制表示中仅包含幸运数字 4 和 7 的正整数。例如,47、744、4 是幸运数,而 5、17、467 不是幸运数。
不幸的是,并非所有数都是幸运数。佩佳称一个数为近似幸运数,如果该数中幸运数字的个数本身是一个幸运数。他想知道数 n 是否为近似幸运数。
输入格式
The only line contains an integer n (1 ≤ n ≤ 1018).
Please do not use the %lld specificator to read or write 64-bit numbers in С++. It is preferred to use the cin, cout streams or the %I64d specificator.
仅一行,包含一个整数 n(1≤n≤1018)。
请勿在 C++ 中使用 %lld 格式说明符读取或写入 64 位整数。推荐使用 cin、cout 流,或 %I64d 格式说明符。
输出格式
Print on the single line "YES" if n is a nearly lucky number. Otherwise, print "NO" (without the quotes).
如果 n 是一个近似幸运数,则在单行上输出 “YES”。否则,输出 “NO”(不带引号)。
输入输出样例
输入#1
40047
输出#1
NO
输入#2
7747774
输出#2
YES
输入#3
1000000000000000000
输出#3
NO
说明/提示
In the first sample there are 3 lucky digits (first one and last two), so the answer is "NO".
In the second sample there are 7 lucky digits, 7 is lucky number, so the answer is "YES".
In the third sample there are no lucky digits, so the answer is "NO".
第一个样例中有 3 个幸运数字(第一个和最后两个),因此答案为 “NO”。
第二个样例中有 7 个幸运数字,而 7 是幸运数字,因此答案为 “YES”。
第三个样例中没有幸运数字,因此答案为 “NO”。
输入解题思路,AI测评打分。不知道怎么写?