Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
74215 | 董承诺 | 位运算 | C++ | Wrong Answer | 40 | 0 MS | 256 KB | 484 | 2023-05-20 17:28:45 |
#include<bits/stdc++.h> using namespace std; string a; int b,c,d; int main(){ cin>>a; b=a.size(); for(int i=0;i<=b-1;i++){ c+=a[i]%'0'; if(a[i]==0) d++; } if(c==1){ cout<<"0"; return 0; } if(b>=2&&a[0]>'1'&&a[b-1]==0){ if(d==b-1){ a[0]=a[0]-1%'0'; a[1]=a[1]+1%'0'; } // if(d!=b-1){ // for(int i=0;i<=b-1;i++){ // if(a[i]!=0&&a[i+1]=='0'){ // // } // } // } } else{ a[b-1]--; cout<<a; } return 0; }