You are viewing a single comment's thread. Return to all comments →
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include<string> #include<sstream> using namespace std; int main() { int n; cin>>n; while(n>0) { string p; cin>>p; int m=0; int l=p.length(); for(int i=1;i<=(l-2);i++) { string s=p.substr(0,i); stringstream g(s); int d=0; g>>d; int sum=0; int count=0; string ss; for(int j=0;j<l;j++) { int x=d+j; string s2=to_string(x); int l2=s2.length(); count=count+l2; ss=ss+s2; if(count==l) break; } if(ss==p) { m=1; cout<<"YES"<<" "<<s; break; } } if(m==0) { cout<<"NO"; } cout<<"\n"; n--; } return 0; }
test case 4 and last 6 test cases are showing wrong output ,can someone help plz?
Seems like cookies are disabled on this browser, please enable them to open this website
Separate the Numbers
You are viewing a single comment's thread. Return to all comments →
test case 4 and last 6 test cases are showing wrong output ,can someone help plz?