c++20,100分最后一个测试点没过,求助,谢谢

P1307 [NOIP2011 普及组] 数字反转

@[“友人A”](/user/463817) 要特判0
by WA_sir @ 2022-09-15 18:46:26


~~不想码字~~,直接上代码 ```cpp #include<bits/stdc++.h> using namespace std; void turn(int n){ int t=0; while(n!=0){ t=t*10+n%10; n/=10; } cout<<t; } int main(){ int n; cin>>n; turn(n); return 0; } ``` 代码实测无WA
by kkk_s_c_03 @ 2022-09-21 20:48:06


相距13分钟,又更新了 ~~这次更了个寂寞~~ 没有函数了,但本质上没有差距 代码奉上 ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int t=0; while(n!=0){ t=t*10+n%10; n/=10; } cout<<t; return 0; } ```
by kkk_s_c_03 @ 2022-09-21 21:04:59


|