c++14解
查看原帖
c++14解
549561
wangqishi001楼主2021/11/3 12:54
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <iomanip>
using namespace std;

int main() {
	long long a = 0 , c = 0 , n = 0 ;
	cin >> c ;
	n = c ;
	if ( c < 0 ) {
		cout << "-" ;
	}
	do {
		a = n % 10 ;
		if ( a != 0 ) {
			c = n ;
			break ;
		}
		n /= 10 ;
	} while ( n != 0 ) ;
	do {
		a = c % 10 ;
		if ( a < 0 ) {
			a -= a * 2 ;
		}
		cout << a ;
		c /= 10 ;
	} while ( c != 0 ) ;
	return 0;
}
2021/11/3 12:54
加载中...