#include <cstdio>
#include <cstring>
bool cmp(char x[], char y[], int len) {
int vix[10], viy[10];
memset(vix, 0, sizeof(vix));
for (int i = 0; i < len; i++)
vix[x[i]-'0']++;
memset(viy, 0, sizeof(viy));
for (int i = 0; i < len; i++)
viy[y[i]-'0']++;
for (int i = 0; i < 10; i++)
if (vix[i] != viy[i])
return true;
return false;
}
int main() {
char x[50];
scanf("%s", x);
int len = strlen(x);
char y[50];
int k = 0;
for (int i = len-1; i >= 0; i--) {
y[i] = (x[i] - '0') * 2 + k;
k = y[i] / 10;
y[i] = y[i] % 10 + '0';
}
if (k || cmp(x, y, len))
puts("No");
else
puts("Yes");
y[len] = '\0';
if (k)
printf("%d", k);
puts(y);
}
1023 Have Fun with Numbers (20) --大数
最新推荐文章于 2017-02-27 11:10:45 发布