Problem--110A--Codeforces--Nearly Lucky Number
来源:互联网 发布:jsp 访问数据库 编辑:程序博客网 时间:2024/06/06 14:34
Nearly Lucky Number
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard outputPetya 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.
Input
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.
Output
Print on the single line “YES” if n is a nearly lucky number. Otherwise, print “NO” (without the quotes).Examples:
input
40047
outputinput
7747774
output
YESinput
1000000000000000000
output
NONote
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”.
#include<stdio.h>int main(){ char str[1000]; scanf("%s",str); int count=0; for(int i=0; str[i]!='\0'; i++) { if(str[i]=='4'||str[i]=='7') count++; } (count==4||count==7)? printf("YES\n"):printf("NO\n");}
- Problem--110A--Codeforces--Nearly Lucky Number
- Codeforces 110A-Nearly Lucky Number(实现)
- CodeForces 110A Nearly Lucky Number
- codeforces 110A Nearly Lucky Number
- 110A - Nearly Lucky Number
- codeforces 110A(Nearly Lucky Number) Java
- CodeForces 110A Nearly Lucky Number (近似幸运数字)
- CodeForces 110 A.Nearly Lucky Number(水~)
- A. Nearly Lucky Number
- A. Nearly Lucky Number
- CF 110A Nearly Lucky Number
- CodeForces 110A Nearly Lucky N…
- Codeforces刷题之路——110A Nearly Lucky Number
- codefroces 110A Nearly Lucky Number(模拟水题)
- 【string】#84 A. Nearly Lucky Number
- Coderforces Nearly Lucky Number
- 『NYIST』第九届河南省ACM竞赛队伍选拔赛[正式赛二]- Nearly Lucky Number(Codeforces Beta Round #84 (Div. 2 Only)A. Nearly)
- 【CodeForces】A. Lucky Division
- win2003无法访问共享文件夹处理方法
- java DOM 解析
- 欢迎使用CSDN-markdown编辑器
- 技术点详解---互联网应用如何穿越NAT
- 列表标签
- Problem--110A--Codeforces--Nearly Lucky Number
- 图示符号指南
- viewPager+多个Fragment状态保存
- WebVR简介
- MySQL server has gone away的解决方法
- Ambari 常用的 REST API 介绍
- 软件测试——Junit、Hamcrest、Eclemma的安装和使用
- Today Extension/widget编程
- Oracle在线重做日志文件详解