Chef and digits of a number

#include <bits/stdc++.h> using namespace std; int main () { int x; cin>>x; for(int i=0;i<x;i++){ string a; cin>>a; int no=0; for(int j=0;j<a.length();j++){ if(a[j]=='1') no++; } if(no==a.length()-1||no==1) cout<<"Yes"<<endl; else cout<<"No"<<endl; } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.