poj 1504 水题
2017-04-09 16:32
176 查看
输入俩个数,将这两个数反转相加后再反转输出。
#include<iostream>
using namespace std;
int reversed(int a)
{
int b=0;
while(a)
{
b=b*10+a%10;
a=a/10;
}
return b;
}
int main()
{
int n;
int a,b,c;
cin>>n;
while(n--)
{
cin>>a>>b;
cout<<reversed(reversed(a)+reversed(b))<<endl;
}
}
#include<iostream>
using namespace std;
int reversed(int a)
{
int b=0;
while(a)
{
b=b*10+a%10;
a=a/10;
}
return b;
}
int main()
{
int n;
int a,b,c;
cin>>n;
while(n--)
{
cin>>a>>b;
cout<<reversed(reversed(a)+reversed(b))<<endl;
}
}
相关文章推荐
- POJ 1504 Adding Reversed Numbers(我的水题之路——逆向数高精度加法)
- POJ 1504 (一个水题引发的血案)
- poj 1504 Adding Reversed Numbers(数学水题)
- POJ 2128 Highways(我的水题之路——最小两条公路之和)
- POJ 2159 Ancient Cipher(我的水题之路——双重加密)
- POJ 2301 Beat the Spread!(我的水题之路——两数之和、两数之差)
- poj水题之路(转)
- POJ 2562 Primary Arithmetic(我的水题之路——模拟加法进位)
- POJ 2840 Big Clock(我的水题之路——水,钟)
- POJ 2301 Beat the Spread <水题>
- POJ 3086 Triangular Sums(我的水题之路——三角数累加)
- POJ 3094 Quicksum(水题) 涉及到字…
- POJ——3264Balanced Lineup(RMQ模版水题)
- POJ 3620 Avoid The Lakes【DFS水题练格式Avoid The Lakes Time Limit: 1000MS Memory Limit: 65536K Total Sub】
- poj 1503(水题)
- POJ 2262 Goldbach's Conjecture (水题)
- poj 2586 Y2K Accounting Bug(贪心算法,水题一枚)
- POJ 1861 && ZOJ 1542--Network 【最小生成树 && kruscal && 水题】
- poj入门水题--深度搜索(dfs)题 1011,含各种剪枝,比较经典
- poj水题