PAT1023. Have Fun with Numbers (20)
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
string a;
string b;
bool cmp(char a,char b){
return a<b;
}
int main()
{
cin>>a;
b=a;
int num;int c=0;
for(int i=a.length()-1;i>=0;i--){
num=(a[i]-'0')*2+c;
c=num/10;
b[i]=num%10+'0';
}
if(c!=0){cout<<"No"<<endl;cout<<c<<b;}
else{
sort(a.begin(),a.end(),cmp);
string c=b;
sort(b.begin(),b.end(),cmp);
if(a.compare(b)==0){cout<<"Yes"<<endl;}
else {cout<<"No"<<endl;}
cout<<c;
}
return 0;
}
PAT1023. Have Fun with Numbers (20)的更多相关文章
- How to Pronounce Numbers 20 – 1 Billion
How to Pronounce Numbers 20 – 1 Billion Share Tweet Share Tagged With: Numbers Numbers are something ...
- PAT甲级 1120. Friend Numbers (20)
1120. Friend Numbers (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Two in ...
- pat00-自测4. Have Fun with Numbers (20)
00-自测4. Have Fun with Numbers (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yu ...
- pat1100. Mars Numbers (20)
1100. Mars Numbers (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue People o ...
- pat1069. The Black Hole of Numbers (20)
1069. The Black Hole of Numbers (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, ...
- PAT-中国大学MOOC-陈越、何钦铭-数据结构基础习题集 00-自測4. Have Fun with Numbers (20) 【二星级】
题目链接:http://www.patest.cn/contests/mooc-ds/00-%E8%87%AA%E6%B5%8B4 题面: 00-自測4. Have Fun with Numbers ...
- 1069. The Black Hole of Numbers (20)【模拟】——PAT (Advanced Level) Practise
题目信息 1069. The Black Hole of Numbers (20) 时间限制100 ms 内存限制65536 kB 代码长度限制16000 B For any 4-digit inte ...
- PAT 甲级 1069 The Black Hole of Numbers (20 分)(内含别人string处理的精简代码)
1069 The Black Hole of Numbers (20 分) For any 4-digit integer except the ones with all the digits ...
- PAT 甲级 1023 Have Fun with Numbers (20 分)(permutation是全排列题目没读懂)
1023 Have Fun with Numbers (20 分) Notice that the number 123456789 is a 9-digit number consisting ...
随机推荐
- Nginx 的多站点配置
当我们有了一个 VPS 主机以后,为了不浪费 VPS 的强大资源(相比共享主机1000多个站点挤在一台机器上),往往有想让 VPS 做点什么的想法,银子不能白花啊:).放置多个网站或者博客是个不错的想 ...
- 动软生成的WCP DAO层模板(不使用接口)
本实战是博主初次学习Java,分析WCP源码时,学习HibernateTools部分的实战,由于初次接触,难免错误,仅供参考,希望批评指正. 开发环境: Eclipse Version: Photon ...
- Java多线程的两种实现方式
Java总共有两种方式实现多线程 方式1:通过继承Thread类的方式 package com.day04; /** * 通过继承Thread类并复写run方法来是实现多线程 * * @author ...
- 【转】在服务器上排除问题的头五分钟&常用命令
转自:https://blog.csdn.net/l821133235/article/details/80103106(在服务器上排除问题的头五分钟) 遇到服务器故障,问题出现的原因很少可以一下就想 ...
- grafana-----Templating
模板允许更多的互动和动态的仪表板.可以将变量用在度量查询中,不必硬编码诸如服务器.应用程序和传感器名称之类的东西.变量显示在仪表板顶部的下拉式选择框中.这些下拉菜单可以很容易地改变在你的仪表板显示的数 ...
- <2013 12 01> 一篇很好的关于windows编程的入门指导(2013年末写的,比较前沿)
我之前做了不少嵌入式开发,从单片机到ARM到RTOS到Linux等等,可以说走的是电气工程师的路线,对编程也是实用性的,跟计算机学院的科班套路不同.最近同学做一个windowsCE的项目请我帮忙,之前 ...
- django实现密码加密的注册(数据对象插入)
在 django实现密码非加密的注册(数据对象插入)的基础上,我们对视图和注册页面进行了简单修改 视图 from django.shortcuts import render,redirect,ren ...
- 0x06 MySQL 单表查询
一 单表查询语法 SELECT 字段1,字段2... FROM 表名 WHERE 条件 GROUP BY field HAVING 筛选 ORDER BY field LIMIT 限制条数 二 关键字 ...
- vue增删改查
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- html用a标签怎么提交表单
如下代码请 帮忙完善function judgeDelete() { if(confirm("确定要删除吗?")) { window.location ...