南阳oj 400 I'll play a trick on you (细节规律题 简单的字符串处理)
来源:互联网 发布:千牛卖家mac 编辑:程序博客网 时间:2024/06/05 23:48
I'll play a trick on you
时间限制:3000 ms | 内存限制:65535 KB
难度:1
- 描述
- Please look the picture carefully. Then I'll give you two integers and your task is output the third one.
Please never doubt the picture.- 输入
- The first line is a number T(1<=T<=30), represents the number of case. The next T blocks follow each indicates a case.
Each case contains two integers A,B (1<=B<=A<=10^100) - 输出
- For each case, output the number of case and the third integer.
- 样例输入
399 7245 2739 18
- 样例输出
271821
- 来源
2011 Alibaba Programming Contest
难点:
这道题很容易误认为就是直接的加减 但是注意到后面的7
思路:
实际上是 各个数位的数相加的和 加起来就是后来的数
代码如下:
#include<stdio.h>#include<string.h> int main(){int n,i,s1,s2;char s[110],m[110];scanf("%d",&n);while(n--){s1=s2=0;scanf("%s%s",s,m);for(i=0;i<strlen(s);i++)s1+=(s[i]-'0');for(i=0;i<strlen(m);i++)s2+=(m[i]-'0');printf("%d\n",s1+s2);}return 0;}}
0 0
- 南阳oj 400 I'll play a trick on you (细节规律题 简单的字符串处理)
- NYOJ 400题 I'll play a trick on you
- I'll play a trick on you
- I'll play a trick on you
- nyoj-400-I'll play a trick on you
- NYOJ 400 I'll play a trick on you
- NYOJ 题目400 I'll play a trick on you
- hdu 3953 I'll play a trick on you
- hdu 3953 I'll play a trick on you
- HDu--3935(I'll play a trick on you)
- hdu 3953 I'll play a trick on you
- hdu 3953 I'll play a trick on you
- HDU:3953 I'll play a trick on you
- HDU3953 I'll play a trick on you
- ACM-I'll play a trick on you
- ACM_ I'll play a trick on you
- hdu 3953 I'll play a trick on you (递推)
- 2011阿里巴巴程序设计公开赛 1003 I'll play a trick on you
- CTS中的camera相关测试项
- 南阳OJ
- 关于helloworld的多种输出方法
- 有个问题请教一下
- 黑客帝国
- 南阳oj 400 I'll play a trick on you (细节规律题 简单的字符串处理)
- UVa-1513-Movie collection
- 黑马程序员--C语言之数据结构解决问题
- [机器学习]基于OpenCV实现最简单的数字识别
- zeromq(ZMQ)开篇学习小记
- OpenCV下车牌定位算法实现代码
- myeclipse配置hadoop开发环境,及遇到问题解决
- 安装MyEclipse时,双击安装包后出现“could not find main class”的错误提示的解决方法
- RAR和ZIP:压缩大战真相 (挺赞值得了解)