#include<iostream>
#include<cstring>
using namespace std;
int main()
{
int z=;
char fir[]="";
int sec[]={},thi[]={},fo[]={};
int len=;
cin>>fir;
len=strlen(fir);
int len2=len;
for(int i=;i<len;i++) sec[i]=fir[i]-'';
int i=len-;
for(i;i>;i--)
{
thi[i]=*sec[i]+z;
z=thi[i]/;
thi[i]%=;
}
int t=thi[i]; thi[i]=*sec[i]+z;
if(t>=)
{
len2++;
thi[i]=*sec[i]+z;
fo[]=thi[i]/ ;
thi[i]%=;
for(int j=;j<len;j++) fo[j+]=thi[j];
}
else
{
thi[i]=*sec[i]+z;
for(int j=;j<len2;j++) fo[j]=thi[j];
} z=;
for(int k=;k<len2;k++)
{
for(int j=;j<len;j++)
{
if(sec[j]==fo[k]){sec[j]=;z=;break;}
}
if(z!=) {z=;break;}
if(z==) z=; } if(z==)
{
cout<<"Yes"<<endl;
for(int j=;j<len2;j++) cout<<fo[j];
}
if(z!=)
{
cout<<"No"<<endl;
for(int j=;j<len2;j++) cout<<fo[j];
}
return ;
}

PTA_Have fun with numbers(C++)的更多相关文章

  1. Java 位运算2-LeetCode 201 Bitwise AND of Numbers Range

    在Java位运算总结-leetcode题目博文中总结了Java提供的按位运算操作符,今天又碰到LeetCode中一道按位操作的题目 Given a range [m, n] where 0 <= ...

  2. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

  3. [LeetCode] Add Two Numbers II 两个数字相加之二

    You are given two linked lists representing two non-negative numbers. The most significant digit com ...

  4. [LeetCode] Maximum XOR of Two Numbers in an Array 数组中异或值最大的两个数字

    Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231. Find the maximum re ...

  5. [LeetCode] Count Numbers with Unique Digits 计算各位不相同的数字个数

    Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...

  6. [LeetCode] Bitwise AND of Numbers Range 数字范围位相与

    Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers ...

  7. [LeetCode] Valid Phone Numbers 验证电话号码

    Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bas ...

  8. [LeetCode] Consecutive Numbers 连续的数字

    Write a SQL query to find all numbers that appear at least three times consecutively. +----+-----+ | ...

  9. [LeetCode] Compare Version Numbers 版本比较

    Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 &l ...

随机推荐

  1. HBase海量数据存储

    1.简介 HBase是一个基于HDFS的.分布式的.面向列的非关系型数据库. HBase的特点 1.海量数据存储,HBase表中的数据能够容纳上百亿行*上百万列. 2.面向列的存储,数据在表中是按照列 ...

  2. Visual Studio 使用 Web Deploy 发布远程站点

    Ø  简介 本文介绍 Visual Studio 如何使用 Web Deploy发布远程站点,有时候我们开发完某个功能时,需要快速将更改发布至服务器.通常 Visual Studio 可以采用两种方式 ...

  3. python3导入sqlite3报错

    今天把本地运行OK的scrapy爬虫程序捣鼓到服务器上运行,结果报了以下错误 2018-10-11 19:00:19 [twisted] CRITICAL: Unhandled error in De ...

  4. PHP和JS在循环、条件判断中的不同之处

    一.条件判断: php中算  false 的情况 1. boolean:false 2. 整形:0 3.浮点型:0 4.字符串:"" "0"(其他都对) 5.空 ...

  5. Java(20)file i/o

    1 I/0: input/output 1.1.java.io.File 1.2  表示:文件或者文件夹(目录) 1.3 File f = new File("文件路径"); 1. ...

  6. Virtualbox Ubuntu 虚拟机命令行挂载共享文件夹及设置静态IP

    挂载共享文件夹 参考 [1], VirtualBox/GuestAdditions [2], VirtualBox/SharedFolders 步骤 在Virtualbox 虚拟机的菜单『设备』中,点 ...

  7. 找出链表中倒数第K个结点

    思路:两个指针,也是快指针和慢指针,先让快指针走k -1步,这时慢指针开始和快指针一起走到尾部.慢指针停止的点就是倒数第k个节点. public static ListNode findCountDo ...

  8. Django 2.0 官方文档翻译

    from django.contrib import admin from django.urls import include, path urlpatterns = [ path('polls/' ...

  9. C# - 设计模式 - 钩子模式

    钩子模式 问题场景 如何控制抽象类的行为?解决办法是靠钩子!抽象类公布一个虚方法,由子类自行决定是否重写它,抽象类以钩子做判定,如果返回真则执行某个方法,否则不执行.为什么钩子不能是抽象的,因为如果钩 ...

  10. FFT学习笔记

    快速傅里叶变换FFT(Fast Fourior Transform) 先说一下它能干嘛qwq ​ 傅里叶变换有两种,连续傅里叶变换和离散傅里叶变换,OI中主要用来快速计算多项式卷积. 等一下,卷积是啥 ...