求大佬看看这是怎么个事,运行正常但是80分
查看原帖
求大佬看看这是怎么个事,运行正常但是80分
1511991
lingerpetals楼主2024/11/11 22:43
#include<iostream>
#include<string>
using namespace std;

int main()
{
	string s;
	cin >> s;
	string::iterator it = s.end();
	while (s.back() == '0' && s.begin() != --(it))
	{
		//string::iterator it = s.end();
		//s.erase(--(it));
		s.pop_back();
	}
	if (s[0] != '-')
	{
		for (int i = s.size() - 1; i >= 0; i--)
		{
			cout << s[i];
		}
		cout << endl;
	}
	else
	{
		cout << s[0];
		for (int i = s.size() - 1; i > 0; i--)
		{
			cout << s[i];
		}
		cout << endl;
	}
	return 0;
}
2024/11/11 22:43
加载中...