Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
74604 sh25_shenpy 数字反转 C++ 通过 0 MS 256 KB 627 2025-11-29 22:11:24

Tests(3/3):


#include <bits/stdc++.h> using namespace std; int main( ) { int n,w,x,y; cin>>n; if(n<0){ cout<<"-"; } if(n%10>0){ cout<<n%10; } if(n%10<0){ cout<<-(n%10); } for(int u=1;u<=10;u++){ x=pow(10,u); if(n<x&n>-x){ y=u; break; } } for(int i=1;i<y;i++){ x=pow(10,i); w=n%x; if(((n-w)/x)%10>0){ cout<<((n-w)/x)%10; } if(((n-w)/x)%10<0){ cout<<-((n-w)/x)%10; } } if(n==0){ cout<<"0"; } return 0; }


测评信息: