#include<cstdio>#include<iostream>#include<string>#include<string.h>#include<algorithm>#include<queue>#include<map>#include<set>#include<cmath>using namespace std;struct bign{ int d[22]; int len; bign() { memset(d,0,sizeof(d)); len=0; }};string str1,str2;bign _double(bign a){ bign c; int carry=0; for(int i=0;i<str1.length();i++) { int temp=a.d[i]+a.d[i]+carry; carry=temp/10; c.d[c.len++]=temp%10; } if(carry!=0) c.d[c.len++]=carry; if(c.len-1>1&&c.d[c.len-1]==0) c.len--; return c;}void PRint(bign a){ for(int i=0;i<a.len;i++) { printf("%d",a.d[a.len-1-i]); }}int main(){ bign a; //freopen("input.txt","r",stdin); cin>>str1; for(int i=0;i<str1.length();i++) { a.d[i]=str1[str1.length()-1-i]-'0'; } bign b=_double(a); int hash1[10]={0}; int hash2[10]={0}; bool flag=false; if(b.len!=str1.length()) { printf("No/n"); print(b); } else { for(int i=0;i<str1.length();i++) { hash1[str1[i]-'0']++; hash2[b.d[i]]++; } for(int i=0;i<10;i++) { if(hash1[i]!=hash2[i]) { flag=true; } } if(flag==true) { printf("No/n"); print(b); } else { printf("Yes/n"); print(b); } } //freopen("con","r",stdin); system("pause"); return 0;}
新闻热点
疑难解答