1023

Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9, only in a different permutation. Check to see the result if we double it again!

Now you are suppose to check if there are more numbers with this property. That is, double a given number with k digits, you are to tell if the resulting number consists of only a permutation of the digits in the original number.

Input Specification:

Each input file contains one test case. Each case contains one positive integer with no more than 20 digits.

Output Specification:

For each test case, first print in a line “Yes” if doubling the input number gives a number that consists of only a permutation of the digits in the original number, or “No” if not. Then in the next line, print the doubled number.
Sample Input:

1234567899

Sample Output:

Yes
2469135798

#include <iostream>
#include <string.h>

using namespace std;

int main()
{
    char num[21];
    scanf("%s", num);
    int len = strlen(num);
    int isdou = 1;
    int plus1 = 0;
    int t[10]={0};
    int temp;
    for(int i=len-1;i>=0;i--)
    {
        temp = num[i]-'0';
        t[temp]++;
        if(temp >= 5)
        {
            t[temp*2-10+plus1]--;
            num[i] = temp*2-10+plus1 + '0';
            plus1 = 1;
        }
        else
        {
            t[temp*2+plus1]--;
            num[i] = temp*2+plus1 + '0';
            plus1 = 0;
        }
    }
    for(int i=0;i<10;i++)
    {
        if(t[i] != 0)
            isdou = 0;
    }

    if(isdou == 1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    if(plus1 == 1)
        cout << "1";
    printf("%s", num);
    return 0;
}
MySQL错误1023是指SQLSTATE为HY000的错误,错误消息是"错误:1023 SQLSTATE: HY000 (ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE)"。这个错误意味着在尝试修改GTID_EXECUTED表时发生了错误。GTID_EXECUTED表是用于存储全局事务标识符(GTID)的表,它用于复制和同步MySQL数据库。这个错误通常是由于权限问题或者GTID配置错误引起的。要解决这个问题,可以尝试以下几个步骤: 1. 确保你有足够的权限来修改GTID_EXECUTED表。检查你使用的MySQL用户是否具有适当的权限。 2. 检查你的GTID配置,确保它与你的MySQL复制设置兼容。GTID配置错误可能会导致修改GTID_EXECUTED表时出现错误。 3. 如果你不需要使用GTID复制,可以尝试禁用GTID功能。你可以通过修改MySQL配置文件中的gtid_mode参数来实现。 4. 如果以上步骤都没有解决问题,你可以尝试重新创建GTID_EXECUTED表。首先备份当前的GTID_EXECUTED表,然后删除它,最后重新创建一个新的GTID_EXECUTED表。 注意:在执行任何数据库操作之前,请确保已经做好了备份,并且谨慎操作,以免造成数据丢失或其他问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [MYSQL常见出错代码解析](https://blog.csdn.net/quxiuer/article/details/4351346)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值