主站
DreamJudge
院校信息
专业题库
模拟考试
机试真题
专业课程
讨论区
兑换中心
登录
注册
发布
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
烟杨绿未成
2020年5月8日 09:28
不断求个位,把其乘10即可
P1003
回复 0
|
赞 0
|
浏览 9.5k
#include<stdio.h> #include<iostream> #include<string.h> #include<math.h> #include<algorithm> #include<map> using namespace std; //思路:不断地取出各位数字,把它乘10,最终实现翻转 int NumReverse(int n) { int ReverseNum = 0; while(...
toxible
2020年5月3日 17:00
有点耍滑头,但是姑且能通过。
P1003
回复 0
|
赞 1
|
浏览 9.7k
#include<stdio.h> #include<string.h> int trans(char *str){ //懒得考虑位数问题,干脆选择以字符串的形式操作。 int length=strlen(str); int num=0; int pos=1; for(int i=0;i<length;i++){ num+=((int)str[i]-48)*pos; pos=10*pos; } return num; } int main(){ char n[10...
ymw1836828452
2020年4月30日 12:26
题解
P1003
回复 0
|
赞 0
|
浏览 8.6k
#include <stdio.h> #include <math.h> int main() {int a,b; while( scanf("%d%d",&a,&b)!=EOF)//当是输入为ctrl+z是,结束 {int s=0,f[10],e[10],m=0,n=0,j,k=0; int i=0; while(1) { if(a!=0){ e[i]=a%10;m++; } &nbs...
wugenqiang
2020年3月23日 21:35
P1003 - 翻转数的和 - C
P1003
回复 0
|
赞 4
|
浏览 12.8k
/*Time Limit: 1000 ms Memory Limit: 256 mb 喜欢数学的Lucy经常向哥哥LF请教一些题目,哥哥总能很快就帮她解决。这不,Lucy又有难题要请教哥哥了Lucy的难题。 Lucy的难题是有关翻转数的: 翻转数就是把一个数的所有数字以相反顺序写出来,即原来的第一个数字成为最后一个,而原来的最后一个则成为第一个。我们把未翻转的数称为翻转数的原数。 例 如:6789的翻转数是9876,而6789就是9876的原数。 你一定注意到了,一个翻转数的原数可以有很多个,例如18的原数可以是81、810、8100等等。因此我们假定:通过翻转数求原数时...
A1120161820
2020年3月18日 15:37
翻转数字和(c++)
P1003
回复 0
|
赞 0
|
浏览 8.5k
#include<iostream> using namespace std; int reverse(int num) { int ans = 0;//翻转结果 while (num > 0) { int tmp = num%10; ans *= 10; ans += tmp; num /= 10; } return ans; } int main() { int a, b; while (cin >> a >> b) {//EOF结束输入 int c = reverse(...
zero42
2020年3月16日 17:57
1003,求翻转数的原数之和
P1003
回复 0
|
赞 0
|
浏览 7.3k
#include using namespace std; //数字转字符串 int reserve(int a){ int sum=0; int k=a; while(k>0){ sum=sum*10+k%10; k/=10; } return sum; } int main(){ int a,b; while(cin>>a>>b){ int c =reserve(a); int d =reserve(b); cout << c+d << endl; ...
猛士骁将
2020年3月10日 18:42
1003 - 翻转数的和
P1003
回复 0
|
赞 0
|
浏览 9.0k
#include <stdio.h> int Reverse(int x)//翻转函数 { int aft_Rev = 0, yu = 0; while (x) { yu = x % 10; aft_Rev = aft_Rev * 10 + yu; &n...
codesuc
2020年3月5日 15:52
编译器运行是对的,但不知道为何通过不了,大佬求解(已明白)
P1003
回复 5
|
赞 0
|
浏览 9.8k
#include<stdio.h> int fanzhuan(int a){ int c=a*10,n[9],m=0,e=0,q=1,i,j,r; for(i=1;a%i==0;i*=10){ c=c/i; } for(j=10;;j*=10){ if(c!=0){ n[m++]=c%10; c=c/10; } else break; } m-=1; for(;m>=0;m--){ e+=q*n[m]; q=q*10; } return e; } int ma...
544065797
2020年2月28日 16:18
应该可以运行
P1003
回复 1
|
赞 0
|
浏览 8.7k
#include "stdio.h" int main(){ int in1,in2,sum; int Trans(int x); while((scanf("%d %d",&in1,&in2))!=EOF){ in1=Trans(in1); in2=Tran...
Jeff_zhu
2020年2月17日 19:05
简洁~~,_(:ι」∠)_好饿,但是不想动
P1003
回复 0
|
赞 2
|
浏览 10.2k
#include<bits/stdc++.h> using namespace std; int main() { int a, b; while(~scanf("%d %d", &a, &b)) { int ans1 = 0, ans2 = 0; while(a != 0) { ans1 = ans1 * 10 + a % 10; a /= 10; } while(b != 0) { ...
1
2
3
4
题目
翻转数的和
题解数量
33
发布题解
热门题解
1
P1003 - 翻转数的和 - C
2
简洁~~,_(:ι」∠)_好饿,但是不想动
3
有点耍滑头,但是姑且能通过。
4
利用sscanf()实现
5
运用字符串函数stoi直接转为整数再相加
6
翻转数的和 题解:自用笔记
7
只包括函数和循环方法,比较前面两位较易懂因为我是大一学生语言较简单。
8
翻转数的和 题解:
9
翻转数的和 题解:
10
翻转数的和 题解: 实质就是拆分每个数