题目地址


注意点:

  • 小题小做.
  • 逻辑清晰.

#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
char str[50];
int main(){
	cin>>str;
	int cnt=strlen(str)-1;
	bool isNegative=false;
	if(str[0]=='-'){
		cout<<"-";
		int i=cnt;
		while(str[i]=='0')i--;
		for(;i>=1;i--)
				cout<<str[i];
	}else {
		int i=cnt;
		while(str[i]=='0')i--;
		for(;i>=0;i--)
			cout<<str[i];
	}
	printf("\n");
	return 0;
}