鲁锦聪 @ 2021-07-23 12:08:47
#include <bits/stdc++.h>
using namespace std;
char a[100];
int main(){
cin >> a;
int l = strlen(a);
if(a[0] == '-')
cout << "-";
for(int i = l - 1;i >= 0;i--){
if(a[i] != '0' && a[i] != '-')
cout << a[i];
}
return 0;
}
by _l_l_l_l_l_ @ 2021-07-23 12:23:58
@鲁锦聪 中间的0不能省略
by 小杨小小杨 @ 2021-07-23 12:34:19
@鲁锦聪 只有末尾的连续的零才可以省略
by 鲁锦聪 @ 2021-07-23 15:33:10
我知道,但改不出来了
by 鲁锦聪 @ 2021-07-23 15:33:18
@WenZKbb
by 鲁锦聪 @ 2021-07-23 15:33:29
@小杨小小杨
by 小杨小小杨 @ 2021-07-23 15:39:24
#include <bits/stdc++.h>
using namespace std;
char a[100];
int main(){
cin >> a;
int l = strlen(a)-1;
if(a[0] == '-')
cout << "-";
int h=0;
if (a[h]=='-') h++;
while (a[l]=='0') l--;
for (int i=l;i>=h;i--) printf("%c",a[i]);
return 0;
}
by 小杨小小杨 @ 2021-07-23 15:39:37
@鲁锦聪
by 鲁锦聪 @ 2021-07-23 15:42:52
@小杨小小杨 懂了,谢谢大佬
by Tattbimh @ 2021-08-10 10:01:05
#include<bits/stdc++.h>
using namespace std;
int n,ans;
int main()
{
cin>>n;
while(n)
{
ans*=10;
ans+=n%10;
n/=10;
}
cout<<ans;
return 0;
}
by Tattbimh @ 2021-08-10 10:01:29
@失去我又如何 不想吗