zcmu 1524-Problem D: 猜数字
来源:互联网 发布:mac如何装数位板 编辑:程序博客网 时间:2024/06/06 20:50
Description
奔跑吧,兄弟 里有一个猜数游戏 。
提供X个信息:
0=1
1=0
2=0
3=0
4=0
5=0
6=1
7=0
8=2
。
。
。
38269=4
17522=0
请问对于整数N ,求出N对应的数字
Input
第一行输入一个T(T<=100),表示有T组数据。
接下来每行输入一个整数N (0<=N<10^1000)
Output
输出N对应的数字。
Sample Input
4
38269
8888
6668
17522
Sample Output
4
8
5
奔跑吧,兄弟 里有一个猜数游戏 。
提供X个信息:
0=1
1=0
2=0
3=0
4=0
5=0
6=1
7=0
8=2
。
。
。
38269=4
17522=0
请问对于整数N ,求出N对应的数字
Input
第一行输入一个T(T<=100),表示有T组数据。
接下来每行输入一个整数N (0<=N<10^1000)
Output
输出N对应的数字。
Sample Input
4
38269
8888
6668
17522
Sample Output
4
8
5
0
找规律
code:
#include<iostream>#include<algorithm>#include<stdio.h>#include<queue>#include<math.h>#include<string.h>#include<stdlib.h>using namespace std;typedef long long ll;int main(){// freopen("input.txt","r",stdin); int t; int a[10]={1,0,0,0,0,0,1,0,2,1}; cin>>t; while(t--){ string s; int num=0; cin>>s; for(int i=0;i<s.length();i++){ int m=s[i]-'0'; num+=a[m]; } cout<<num<<endl; } return 0;}
0 0
- zcmu 1524-Problem D: 猜数字
- ZCMU-Problem D - Zipf's Law
- ZCMU-Problem C - Sumsets
- ZCMU-Problem E - Ones
- ZCMU-校赛D-1779
- ZCMU-1755-数字整除
- ZCMU-1169-数字游戏
- ZCMU-1517-A Sorting Problem
- zcmu 1901: Problem E: Logo
- ZCMU-1150-搭数字1
- ZCMU-1151-搭数字2
- ZCMU-训练赛-Problem A: Freckles
- Problem D
- Problem D
- Problem D
- problem D
- Problem D
- Problem D
- 纪中2016.8.13比赛不明总结
- poj3050【dfs】
- 51NOD 1421 最大MOD值&&Codeforces 484 B. Maximum Value(筛法 + 二分)
- android错误之Suggestion: use tools:overrideLibrary="com.xys.libzxing" to force usage
- Redis深入之路(二)
- zcmu 1524-Problem D: 猜数字
- 枚举.原始值
- cocos2d-x-3.12环境搭建
- Longest common prefix_Leetcode_#14
- 校招算法之插入排序
- c++程序连接及装载过程详解
- hdu 2019
- bzoj2002[Hnoi2010]Bounce 弹飞绵羊 块状链表学习小记
- Java_expression