本地编译没问题但CE

P1307 [NOIP2011 普及组] 数字反转

peter20112011 @ 2023-10-06 15:25:53

#include <iostream> 
#include <stdio.h> 
using namespace std;
#define ll long long
int reverse(ll x){
    ll y=0;
    while(x!=0){
        y=y*10+x%10;
        x/=10;
    }
    return (y<INT_MIN||y>INT_MAX) ? 0 : y;  
}
int main(){
    ll n;
    cin>>n;
    cout<<reverse(n)<<endl;
    return 0;
}

by CarrotMeow @ 2023-10-06 15:27:43

INT_MIN & INT_MAX 没有导入


|