提交时间:2023-05-26 19:22:21

运行 ID: 74466

#include<iostream> #include<cstdio> using namespace std; #define maxn 10 int n,bit[maxn],len; int main(){ freopen("bit.in","r",stdin); freopen("bit.out","w",stdout); scanf("%d",&n); while(n){ bit[++len]=n%10; n/=10; } int now=1; while(bit[now]==0) now++; bit[now]--; while(bit[len]==0&&len>=1) len--; if(len==0) printf("0"); else{ for(int j=len;j>=1;j--) printf("%d",bit[j]); fclose(stdin); fclose(stdout); } return 0; }