c++14解

P1307 [NOIP2011 普及组] 数字反转

wangqishi001 @ 2021-11-03 12:54:20

#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;
}

by int127 @ 2021-11-03 12:55:44

又是一个伞兵


by SfumatoCannon_ @ 2021-11-03 13:22:58

哦,但这和c++14有什么关系


by 0x3F @ 2021-11-03 15:03:49

tlqtj jbl


by siyu0816 @ 2022-09-18 17:18:41

有必要吗???


|