Code Festival D Compress numbers by cympfh

#include<bits/stdc++.h>
int main(){for(std::string s,t;std::cin>>s>>t;){int i=0,j,a=1,y,x;for(j=0;j<t.size();++j){y=t[j]-'0';if(i>=s.size()){a=0;break;}for(x=0;i<s.size();++i){x+=s[i]+2;if(x%10==y)break;}if(x%10!=y)a=0;++i;}for(j=0;i<s.size();j+=s[i++]+2);if(a&&j%10)a=0;puts(a?"YES":"NO");}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page