南阳844--A+B Problem(V)

A+B Problem(V)

时间限制:1000 ms  |  内存限制:65535 KB

难度:1

描述
做了A+B Problem之后,Yougth感觉太简单了,于是他想让你求出两个数反转后相加的值。帮帮他吧
输入
有多组测试数据。每组包括两个数m和n,数据保证int范围,当m和n同时为0是表示输入结束。
输出
输出反转后相加的结果。
样例输入

1234 1234
125 117
0 0

  

样例输出

8642
1232

来源
Yougth原创

 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 #include<string.h>
 4 int interger(char ch[20])
 5 {
 6     int i,sum=0;
 7     for(i=strlen(ch)-1;i>=0;i--)
 8     sum=sum*10+ch[i]-‘0‘;
 9     return sum;
10 }
11 int main()
12 {
13     int a,b;
14     while(~scanf("%d %d",&a,&b)&&(a+b))
15     {
16         char ch[20],str[20];
17         sprintf(ch,"%d",a);
18         int m=interger(ch);
19         sprintf(str,"%d",b);
20         int n=interger(str);
21         printf("%d\n",m+n);
22     }
23     return 0;
24 }

时间: 2024-10-12 01:34:03

南阳844--A+B Problem(V)的相关文章

NYOJ 844 A+B Problem(V)

#include<stdio.h>int change(int n){ int t=0; while(n) { t=t*10+n%10; n/=10; } return t;}int main(){ int a,b; while(scanf("%d%d",&a,&b) !=EOF && a!=0 && b!=0) { printf("%d\n",change(a)+change(b)); }}

1254 Problem V

问题 V: 光棍的yy 时间限制: 1 Sec  内存限制: 128 MB 提交: 42  解决: 22 [提交][状态][讨论版] 题目描述 yy经常遇见一个奇怪的事情,每当他看时间的时候总会看见11:11,这个很纠结啊. 现在给你m个1,你可以把2个1组合成一个2,这样就不是光棍了,问这样的组合有多少种?? 例如(111  可以拆分为 111 12 21  有三种) 输入 第一行输入一个n表示有n个测试数据 以下n行,每行输入m个1 (1 <= n,m <= 200) 输出 输出这种组合种

Problem V: 零起点学算法20——输出特殊值II

#include<stdio.h> int main() { printf("\\n"); return 0; } 原文地址:https://www.cnblogs.com/chenlong991223/p/9720428.html

英语基础-01

You have to believe in yourself. That's the secret of success.  #你必须要相信自己,因为这是成功的秘诀. Learn  a+辅音 a Kindle a notbook a smart phone a VR camera an+元音 an English book an eraser  #橡皮擦 an apple an orange 对话: Wow ! What's this ?   #哎哟我去,这是什么? It's a VR cam

XVII Open Cup named after E.V. Pankratiev Stage 14, Grand Prix of Tatarstan, Sunday, April 2, 2017 Problem A. Arithmetic Derivative

题目:Problem A. Arithmetic DerivativeInput file: standard inputOutput file: standard inputTime limit: 1 secondMemory limit: 256 mebibytesLets define an arithmetic derivative:? if p = 1 then p0 = 0;? if p is prime then p0 = 1;? if p is not prime then n0

(DS 《算法入门经典》)UVA 11991 Easy Problem from Rujia Liu?(求第k个v出现的索引)

题目大意: 求第k个v出现的索引 解题思路: 如果能构造出一个数据结构,使得data[v][k]就是第k个v出现的索引值即可求解.data[v]表示数v出现的索引数组, data[v][k]表示第k个v出现的索引. Problem E Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for example, regional contests like Xi'an 200

A+B Problem(V)

A+B Problem(V) 描述 做了A+B Problem之后,Yougth感觉太简单了,于是他想让你求出两个数反转后相加的值.帮帮他吧 输入 有多组测试数据.每组包括两个数m和n,数据保证int范围,当m和n同时为0是表示输入结束. 输出 输出反转后相加的结果. 样例输入 1234 1234 125 117 0 0 样例输出 8642 1232 #include <iostream> #include <cmath> using namespace std; int reve

XVII Open Cup named after E.V. Pankratiev Grand Prix of Moscow Workshops, Sunday, April 23, 2017 Problem D. Great Again

题目: Problem D. Great AgainInput file: standard inputOutput file: standard outputTime limit: 2 secondsMemory limit: 512 megabytesThe election in Berland is coming. The party United Berland is going to use its influence to win themagain. The crucial co

XVII Open Cup named after E.V. Pankratiev Grand Prix of Moscow Workshops, Sunday, April 23, 2017 Problem K. Piecemaking

题目:Problem K. PiecemakingInput file: standard inputOutput file: standard outputTime limit: 1 secondMemory limit: 512 mebibytesThe civil war in Berland continues for five years already. The United Nation decided to end the bloodshed.Berland consists o