PTA_Have fun with numbers(C++)


#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++)的更多相关文章
- Java 位运算2-LeetCode 201 Bitwise AND of Numbers Range
在Java位运算总结-leetcode题目博文中总结了Java提供的按位运算操作符,今天又碰到LeetCode中一道按位操作的题目 Given a range [m, n] where 0 <= ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
- [LeetCode] Add Two Numbers II 两个数字相加之二
You are given two linked lists representing two non-negative numbers. The most significant digit com ...
- [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 ...
- [LeetCode] Count Numbers with Unique Digits 计算各位不相同的数字个数
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...
- [LeetCode] Bitwise AND of Numbers Range 数字范围位相与
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers ...
- [LeetCode] Valid Phone Numbers 验证电话号码
Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bas ...
- [LeetCode] Consecutive Numbers 连续的数字
Write a SQL query to find all numbers that appear at least three times consecutively. +----+-----+ | ...
- [LeetCode] Compare Version Numbers 版本比较
Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 &l ...
随机推荐
- Linux下的sudo及配置
sudo的常用命令 man sudoers # 参阅帮助 visudo # 编辑sudoers文件的命令 sudo -l # 查看可执行或禁止执行的命令 sudo -u user1 /bin/ls # ...
- Event filter with query "SELECT * FROM __InstanceModi
Event filter with query "SELECT * FROM __InstanceModi 问题描述: Details -Event filter with quer ...
- Java反射-修改字段值, 反射修改static final修饰的字段
反射修改字段 咱们从最简单的例子到难, 一步一步深入. 使用反射修改一个private修饰符的变量name 咱们回到主题, 先用反射来实现一个最基础的功能吧. 其中待获取的name如下: public ...
- CORS跨域 Ajax headers 问题
今天我们遇到了一个CORS跨域的问题Ajax如下 var url = "http://localhost:11980/api/Demo/GetString"; //api地址 $. ...
- RabbitMQ资料
安装以及网页插件: https://www.cnblogs.com/longlongogo/p/6489574.html Exchange详解: https://www.cnblogs.com/jul ...
- sql注入中关于--+的一点探索
在sql-labs游戏中,经常使用--+放在最后注释多余部分,而mysql中的注释符为#和-- 却不能直接使用,以前没学过mysql,一直不理解,也不知道+号的作用,今天有时间特地探索了一下,算是搞明 ...
- django_1
新闻 管理 Django-1 一 什么是web框架? 框架,即framework,特指为解决一个开放性问题而设计的具有一定约束性的支撑结构,使用框架可以帮你快速开发特定的系统,简单地说,就是你 ...
- 2018-2019-2 20165325 《网络对抗技术》 Exp5:MSF基础应用
2018-2019-2 20165325 <网络对抗技术> Exp5:MSF基础应用 实验内容(概要) 1.1 一个主动攻击实践,本实验选择 ms17_010_eternalblue(成功 ...
- vue面试题总结
1.vue双向绑定的实现原理2.js的继承和原型链3.es6语法箭头函数和普通函数的区别 普通函数的this总是指向它的直接调用者. 在严格模式下,没找到直接调用者,则函数中的this是undefin ...
- django+vue
django安装配置方式略过 1.安装node.js,官网地址:https://nodejs.org/zh-cn/download/ 2.cd到项目目录下,执行npm install -g vue-c ...