竞赛
考级
#include<bits/stdc++.h> using namespace std; int main(){ int a,b=0,count=0; cin>>a; while(true){ b=a%10; count=count*10+b; a/=10; if(a==0){ break; } } cout<<count; return 0; }
LS_YZY
#include<bits/stdc++.h> using namespace std; int main() { return 0; }
________________
AC代码
唱跳坤
Python解法来了 很简单所以不细讲 其实还有一Python[链接描述]个自带翻转函数但是用不详情见链接第2项Python 实现字符串反转的9种方法
199****0772
dchk-SY
#include<bits/stdc++.h> using namespace std; int n,s=0; int main()//以上应该都懂,不解释 { cin>>n;//烦死了输入 while(n) s=s*10+n%10,n/=10;//如果n不是0,就一直s让一位,腾个0出来,n最后一位跟上去,再无情地抛弃了最后一位 cout<<s;//烦死了输出 return 0; }
Alxe
我算是第一次见这种题能放提高里面的。直接冲进语法入门。
毛奕程
请看代码; 包AC
吴泽宇
凋零的铃兰花
#include <iostream> using namespace std; int reverseNumber(int n) { int reversed = 0; while(n != 0) { int digit = n % 10; reversed = reversed * 10 + digit; n /= 10; } return reversed; } int main() { int N; cin >> N; }
智慧达达(1)
#include <iostream> using namespace std; int main(){ int n, u; cin >> n; while(n){ u *= 10; u += n % 10; n /= 10; } cout << u; }
残城碎梦
n = list(input().strip()) if '-' in n: # 处理负数 n.remove('-') # 反转数字部分 n.reverse() # 去除前导零 while len(n) > 1 and n[0] == '0': n.pop(0) # 如果全部为零,保留一个零 if not n or all(c == '0' for c in n): print(0) else: print('-' + ''.join(n)) else: # 处理正数 n.reverse() # 去除前导零 while len(n) > 1 and n[0] == '0': n.pop(0) # 如果全部为零,保留一个零 if not n or all(c == '0' for c in n): print(0) else: print(''.join(n))
无语是自闭
#include <iostream> using namespace std; int main(){ int n; cin>>n; int a=0; while(n!=0){ a=a*10+n%10; n/=10; } cout<<a; return 0; }
AAAWA批发王总
N = int(input()) a = N < 0 if a: N = -N b = str(N):-1 b = b.lstrip('0') if not b: c = 0 else: c = int(b) if a: c = -c print(c)
你爹
AC #include<bits/stdc++.h> #include<bits/stdc++.h> using namespace std; int main(){ int a,b=0,count=0; cin>>a; while(true){ b=a%10; count=count*10+b; a/=10; if(a==0){ break; } } cout<<count; return 0; }
敔禾
共35条