当前位置:网站首页>PAT甲级 1023 Have Fun with Numbers
PAT甲级 1023 Have Fun with Numbers
2022-06-27 02:44:00 【九是否非随机的称呼】
数值的位数大于等于20位,大于long long的取值范围要使用string保存
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main(void){
string s, s0, sk;
int i, j, f, h;
cin>>s;
j = 0;
reverse(s.begin(), s.end());
for(int i=0; i<s.size(); i++){
h = (s[i] - '0') * 2 + j;
j = h/10;
f = h%10;
s0 += to_string(f);
if(i==(s.size() - 1) && (j > 0))
s0 += to_string(j);
}
reverse(s0.begin(), s0.end());
sk = s0;
sort(s.begin(), s.end());
sort(s0.begin(), s0.end());
if(s==s0) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
cout<<sk;
return 0;
}
边栏推荐
- Summer planning for the long river
- Flink Learning 2: Application Scenarios
- "All majors are persuading them to quit." is it actually the most friendly to college students?
- 【微服务|Sentinel】降级规则|慢调用比例|异常比例|异常数
- Paddlepaddle 19 dynamically modify the last layer of the model
- Canvas particles: mouse following JS effect
- Oracle/PLSQL: Substr Function
- Learning Tai Chi Maker - mqtt (VII) advanced mqtt theme
- Introduction to stm32
- QIngScan使用
猜你喜欢

three.js多米诺骨牌js特效

p5.js死亡星球

Is the division of each capability domain of Dama, dcmm and other data management frameworks reasonable? Is there internal logic?

学习太极创客 — MQTT(九)ESP8266 同时订阅和发布 MQTT 消息

What if asreml-r does not converge in operation?

【微服务|Sentinel】降级规则|慢调用比例|异常比例|异常数

DAMA、DCMM等数据管理框架各个能力域的划分是否合理?有内在逻辑吗?

记录unity 自带读取excel的方法和遇到的一些坑的解决办法

CVPR2022 | PointDistiller:面向高效紧凑3D检测的结构化知识蒸馏

Detailed explanation of ThreadLocal
随机推荐
Sword finger offer 𞓜: stack and queue (simple)
How do I simplify the development of interfaces in open source systems?
Uninstallation of Dameng database
three. JS domino JS special effect
Oracle/PLSQL: Ltrim Function
1. Project preparation and creation
Memcached basics 14
How to solve the problem of low applet utilization
Hot discussion: what are you doing for a meaningless job with a monthly salary of 18000?
Learning Tai Chi Maker - mqtt Chapter 2 (II) esp8266 QoS application
Learn from Taiji Maker - mqtt Chapter 2 (I) QoS service quality level
执念斩长河暑期规划
DAMA、DCMM等数据管理框架各个能力域的划分是否合理?有内在逻辑吗?
dat. gui. JS star circle track animation JS special effect
Super détaillé, 20 000 caractères détaillés, mangez à travers es!
jwt的认证流程和使用案例
How does source insight (SI) display the full path? (do not display omitted paths) (turn off trim long path names with ellipses)
Google began to roll itself, AI architecture pathways was blessed, and 20billion generation models were launched
JWT certification process and use cases
Oracle/PLSQL: CharToRowid Function
https://github.com/ZouJiu1/PAT