###### PAT 1023. Have Fun with Numbers (20)

#include<cstdio>
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<queue>
using namespace std;
void check(char str[],int j ,int a[])
{
for(int i=0;i<j;i++)

a[str[i]-'0']++;

}
int check1(int a[],int c[])
{
for(int i=0;i<10;i++)
if(a[i]!=c[i])
return 0;
return 1;
}
int main()
{
int n,b;
char str1[22],str2[22];

scanf("%s",str1);
int j=0;
int t=0;
int a[10]={0};
int c[10]={0};
int i;
for(i=strlen(str1)-1;i>=0;i--)
{   str2[j++]=(((str1[i]-'0')*2)+t)%10+'0';
t=((str1[i]-'0')*2+t)/10;

if(i==0&&t>0)
{
str2[j++]=t+'0';
}
}
check(str2,j,a);
check(str1,strlen(str1),c);
if(check1(a,c))
printf("Yes\n");
else
printf("No\n");
for(i=j-1;i>=0;i--)
printf("%c",str2[i]);
printf("\n");

return 0;
}


#### 1023.Have Fun with Numbers (20)

2017-01-26 19:55:32

#### 自测题IV——Have Fun with Numbers (20)

2015-04-26 15:11:09

#### 7-49 Have Fun with Numbers（20 分）

2017-10-18 18:22:42

#### 自测4. Have Fun with Numbers (20)

2015-05-31 12:11:01

#### PAT_自测4_Have Fun with Numbers

2016-11-25 15:06:02

#### 【C/C++】Have Fun with Numbers

2017-09-18 14:09:32

#### PAT 1023. Have Fun with Numbers (20) 【题目开始没理解好，后来折腾半天才搞懂】

2014-03-08 20:39:17

#### PAT PAT 1023. Have Fun with Numbers (20)

2015-12-13 15:12:11

#### pat甲级1023. Have Fun with Numbers (20)

2018-03-14 16:04:27

#### PAT甲级1023. Have Fun with Numbers (20)

2017-02-27 22:15:33

## 不良信息举报

PAT 1023. Have Fun with Numbers (20)