提交时间:2023-05-26 19:16:42
运行 ID: 74464
#include <bits/stdc++.h> using namespace std; char s[1000]; bool flag = false; int main() { freopen("bit.in","r",stdin); freopen("bit.out","w",stdout); scanf("%s",s + 1); int sizee = strlen(s + 1); for (int i = sizee; i >= 1; i--){ if (s[i] != '0'){ s[i]--; break; } } for (int i = 1; i <= sizee; i++) { if (!flag && s[i] != '0'){ flag = 1; } if (flag){ printf("%c",s[i]); } if (!flag){ printf("0"); printf("\n"); } } return 0; }