1.20位的数字,超过了unsigned long long的取值
2.采用string进行存储和检测
3.用哈希进行相同位检测
//#include<string>
//#include <iomanip>
#include<vector>
#include <algorithm>
//#include<stack>
#include<set>
#include<queue>
#include<map>
//#include<unordered_set>
//#include<unordered_map>
//#include <sstream>
//#include "func.h"
//#include <list>
#include<stdio.h>
#include<iostream>
#include<string>
#include<memory.h>
#include<limits.h>
using namespace std;
/*
3
0011111
The Testing Book
Yue Chen
test code debug sort keywords
2011
3333333
Another Testing Book
Yue Chen
test code sort keywords
ZUCS Print2
2012
2222222
The Testing Book
CYLL
keywords debug book
ZUCS Print2
2011
6
1: The Testing Book
2: Yue Chen
3: keywords
4:
5: 2011
3: blablabla
*/
int str2int(string s)
{
int a = 0;
for (int i = 0; i < s.size(); i++)
{
a = s[i] - '0' + a * 10;
}
return a;
}
int main(void)
{
string s;
cin >> s;
string t = "";
int carry = 0;
bool ans = true;
for (int i = s.size() - 1; i >= 0; i--)
{
int digit = (s[i] - '0') * 2 + carry;
carry = digit / 10;
char c = digit % 10 + '0';
t = c + t;
}
if (carry != 0)
{
ans = false;
char c = carry + '0';
t = c + t;
}
if (ans)
{
int digit[10] = { 0 };
for (int i = 0; i < s.size(); i++)
{
digit[s[i] - '0']++;
digit[t[i] - '0']--;
}
for (int i = 0; i < 10; i++)
{
if (digit[i] != 0) ans = false;
}
}
if (ans) cout << "Yes" << endl;
else cout << "No" << endl;
cout << t << endl;
return 0;
}