70

P1307 [NOIP2011 普及组] 数字反转

lrqSB @ 2024-11-14 09:49:12


#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b[10];
    bool c=1;
    cin>>a;if(a<0){
        cout<<"-";
        b[0]=0;
        a=abs(a);
    }
    for(int i=0;i<=9;i++){
        b[i]=a%10;
        a/=10;
    }
    for(int i=0;i<=9;i++){
        if(b[i]==0){
            c=false;
        }if(b[i]!=0){
            c=true;
        }
        if(c!=0){
            cout<<b[i];
        }

    }
}

by LiamZou @ 2024-11-14 10:09:05

就是没开long long awa

#include<bits/stdc++.h>
using namespace std;
#define int long long 
signed main()
{
    int a,b[15];
    bool c=1;
    cin>>a;if(a<0){
        cout<<"-";
        b[0]=0;
        a=abs(a);
    }
    for(int i=0;i<=9;i++){
        b[i]=a%10;
        a/=10;
    }
    for(int i=0;i<=9;i++){
        if(b[i]==0){
            c=false;
        }if(b[i]!=0){
            c=true;
        }
        if(c!=0){
            cout<<b[i];
        }

    }
}

by lrqSB @ 2024-11-15 09:43:15

@LiamZou 不行


by lrqSB @ 2024-11-15 09:43:34

@LiamZou


by jwadj @ 2024-11-27 18:35:41

@lrqSB你现在知道为什么了吗


by lrqSB @ 2024-11-27 20:59:51

@jwadj


by lrqSB @ 2024-11-27 21:00:26

不知道


|