题目1089:数字反转(简单数字转换)
生活随笔
收集整理的這篇文章主要介紹了
题目1089:数字反转(简单数字转换)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
題目鏈接:http://ac.jobdu.com/problem.php?pid=1089
詳解鏈接:https://github.com/zpfbuaa/JobduInCPlusPlus
參考代碼:
// // 1089 數(shù)字反轉(zhuǎn).cpp // Jobdu // // Created by PengFei_Zheng on 04/05/2017. // Copyright ? 2017 PengFei_Zheng. All rights reserved. // #include <stdio.h> #include <iostream> #include <string.h> #include <cstring> #include <algorithm> #include <cmath> #include <climits>using namespace std;int reverse(int x){int tmp = x;int ans = 0;while(tmp!=0){ans = ans*10 + tmp%10;tmp/=10;}return ans; } int n; int main(){scanf("%d",&n);while(n--){int a,b;scanf("%d %d",&a,&b);int sum = a+b;reverse(sum) == reverse(a) + reverse(b) ? printf("%d\n",sum) : printf("NO\n");} } /**************************************************************Problem: 1089User: zpfbuaaLanguage: C++Result: AcceptedTime:0 msMemory:1520 kb ****************************************************************/?
轉(zhuǎn)載于:https://www.cnblogs.com/zpfbuaa/p/6809880.html
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的题目1089:数字反转(简单数字转换)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 修改项目名称之后,访问不到项目的问题
- 下一篇: 【Web网站服务器开发】Apache 和