0也要判断。
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define MAX 20+5
struct bign
{
int d[MAX];
int len;
bign()
{
memset(d, 0, sizeof(d));
len = 0;
}
};
int vis[10];
bign change(char str[])
{
bign a;
a.len = strlen(str);
for (int i = 0; i < a.len; i++)
{
a.d[i] = str[a.len-1-i] - '0';
}
return a;
}
bign multi(bign a, int b)
{
bign c;
int carry = 0;
for (int i = 0; i < a.len; i++)
{
int temp = a.d[i]*b+carry;
c.d[c.len++] = temp%10;
carry = temp/10;
}
while (carry)
{
c.d[c.len++] = carry%10;
carry /= 10;
}
return c;
}
void print(bign a)
{
for (int i = a.len-1; i >= 0; i--)
printf("%d", a.d[i]);
}
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
char str[MAX];
scanf("%s", str);
bign a = change(str);
for (int i = 0; i < a.len; i++)
{
vis[a.d[i]]++;
}
bign c = multi(a, 2);
for (int i = 0; i < c.len; i++)
{
vis[c.d[i]]--;
}
int f = 0;
for (int i = 0; i <=9; i++)
{
if (vis[i] != 0)
{
f = 1;
break;
}
}
if (0 == f)
{
printf("Yes\n");
}
else
{
printf("No\n");
}
print(c);
return 0;
}