为什么错(来自蒟蒻的提问)

P1307 [NOIP2011 普及组] 数字反转

123uuu @ 2023-11-01 12:49:50

#include<bits/stdc++.h>
using namespace std;
int a[10]={0};
int main(){
    int k,i,n;
    cin>>k;
    while(k>=0){
        a[n]=k%10;
        k/=10; 
        n++;
    } 
    for(i=n;i>=0;--i){
        if(a[i]!=0){
            cout<<a[i];
        }
    }
return 0;
} 

by aCssen @ 2023-11-01 13:03:04


|