当前位置:网站首页>[PTA] get rid of singles
[PTA] get rid of singles
2022-04-23 20:22:00 【Maybe】
subject
Their thinking
Imitation Division
1. Accumulate first 1, Until it's bigger than the divisor ( Now you can divide by the divisor )
2. Get the result of division and the remainder of division , Output the result of dividing by
3. Move backward , Fill a
4. repeat 2、3, until 2 The remainder is 0 Stop when
ac Code
#include<iostream>
using namespace std;
int main() {
int n, k = 1, cnt = 1;
cin >> n;
while(k < n) {
k = k * 10 + 1;
cnt++;
}
while(1) {
if(k % n == 0) {
cout << k / n << cnt;
break;
} else {
cout << k / n;
k %= n;
k = k * 10 + 1;
cnt++;
}
}
return 0;
}
版权声明
本文为[Maybe]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204232020000426.html
边栏推荐
- Azkaban recompile, solve: could not connect to SMTP host: SMTP 163.com, port: 465 [January 10, 2022]
- R语言使用timeROC包计算存在竞争风险情况下的生存资料多时间AUC值、使用cox模型、并添加协变量、R语言使用timeROC包的plotAUCcurve函数可视化多时间生存资料的AUC曲线
- How about CICC fortune? Is it safe to open an account
- WordPress plug-in: WP CHINA Yes solution to slow domestic access to the official website
- RT-1052学习笔记 - GPIO架构分析
- Servlet learning notes
- 堡垒机、跳板机JumpServer的搭建,以及使用,图文详细
- Recommend an open source free drawing software draw IO exportable vector graph
- 三十.什么是vm和vc?
- NC basic usage 4
猜你喜欢
. Ren -- the intimate artifact in the field of vertical Recruitment!
PCL点云处理之计算两平面交线(五十一)
Es error: request contains unrecognized parameter [ignore_throttled]
Recommend an open source free drawing software draw IO exportable vector graph
How can matlab obtain the truncated image in trainingimagelabeler
16MySQL之DCL 中 COMMIT和ROllBACK
ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
go-zero框架数据库方面避坑指南
Modeling based on catiav6
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
随机推荐
[graph theory brush question-5] Li Kou 1971 Find out if there is a path in the graph
Plato Farm元宇宙IEO上线四大,链上交易颇高
PostgreSQL basic functions
PIP installation package reports an error. Could not find a version that satisfies the requirement pymysql (from versions: none)
R language ggplot2 visualization: ggplot2 visualizes the scatter diagram and uses geom_ mark_ The ellipse function adds ellipses around data points of data clusters or data groups for annotation
Rédaction de thèses 19: différences entre les thèses de conférence et les thèses périodiques
波场DAO新物种下场,USDD如何破局稳定币市场?
SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
Sqoop imports tinyint type fields to boolean type
SIGIR'22 "Microsoft" CTR estimation: using context information to promote feature representation learning
三十.什么是vm和vc?
Five minutes to show you what JWT is
Intersection calculation of straight line and plane in PCL point cloud processing (53)
论文写作 19: 会议论文与期刊论文的区别
一. js的深拷贝和浅拷贝
Implementation of mypromise
Research on open source OCR engine
R语言ggplot2可视化:ggplot2可视化散点图并使用geom_mark_ellipse函数在数据簇或数据分组的数据点周围添加椭圆进行注释
selenium. common. exceptions. WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
LeetCode动态规划训练营(1~5天)