2 solutions
-
0
Guest MOD
-
0
#include <bits/stdc++.h> using namespace std; char s[20]; int main(){ cin>>(s+1); int n=strlen(s+1); int ans=100; for(int sta=1;sta<(1<<n);sta++){ int tmp=0,cnt=0; for(int i=n-1;i>=0;i--){ int flag=(sta>>i)&1; if(flag0) tmp++; else cnt+=s[i+1]-'0'; } if(cnt%30) ans=min(ans,tmp); } if(ans==100) cout<<"dottle bot"; else cout<<ans; return 0; }
-
0
#include<bits/stdc++.h> using namespace std; int main(){ string a; cin>>a; int ans=100,cnt=0; int n=a.size(); for(int i=1;i<(1<<n);i++){ long long shu=0; cnt=0; for(int j=n-1;j>=0;j--){ if(((i>>j)&1)==0){ cnt++; }else{ shu+=a[j]-'0'; } } if(shu%3==0){ ans=min(ans,cnt); } } if(ans==100){ cout<<"dottle bot"; }else{ cout<<ans; } return 0; }
- 1
Information
- ID
- 183
- Time
- 1000ms
- Memory
- 512MiB
- Difficulty
- 8
- Tags
- (None)
- # Submissions
- 125
- Accepted
- 18
- Uploaded By