当前位置:网站首页>[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
边栏推荐
- The second method of file upload in form form is implemented by fileitem class, servletfileupload class and diskfileitemfactory class.
- go-zero框架数据库方面避坑指南
- SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
- R language uses the preprocess function of caret package for data preprocessing: BoxCox transform all data columns (convert non normal distribution data columns to normal distribution data and can not
- Plato Farm元宇宙IEO上线四大,链上交易颇高
- Devexpress 14.1 installation record
- PCL点云处理之计算两平面交线(五十一)
- ArcGIS js api 4. X submergence analysis and water submergence analysis
- 论文写作 19: 会议论文与期刊论文的区别
- ABAQUS script email auto notification
猜你喜欢
DTMF双音多频信号仿真演示系统
Commit and ROLLBACK in DCL of 16mysql
Notes of Tang Shu's grammar class in postgraduate entrance examination English
On BIM data redundancy theory
DNS cloud school | quickly locate DNS resolution exceptions and keep these four DNS status codes in mind
RT-1052学习笔记 - GPIO架构分析
How can matlab obtain the truncated image in trainingimagelabeler
Recognition of high-speed road signs by Matlab using alexnet
Some basic knowledge of devexpress report development
Scrapy教程 - (2)寫一個簡單爬蟲
随机推荐
BMP JPEG 图片转换为矢量图像 ContourTrace
R language uses timeroc package to calculate the multi time AUC value of survival data under competitive risk, uses Cox model and adds covariates, and R language uses the plotauccurve function of time
Implementation of mypromise
go-zero框架数据库方面避坑指南
selenium. common. exceptions. WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
Identification of bolt points in aerial photography based on perception
Numpy - creation of data type and array
Common form verification
Automatically fill in body temperature and win10 task plan
Intersection calculation of straight line and plane in PCL point cloud processing (53)
Historical track data reading of Holux m1200-e Bluetooth GPS track recorder
PIP installation package reports an error. Could not find a version that satisfies the requirement pymysql (from versions: none)
DNS cloud school | quickly locate DNS resolution exceptions and keep these four DNS status codes in mind
R语言使用caret包的preProcess函数进行数据预处理:对所有的数据列进行BoxCox变换处理(将非正态分布数据列转换为正态分布数据、不可以处理负数)、设置method参数为BoxCox
SQL gets the latest record of the data table
ArcGIS js api 4. X submergence analysis and water submergence analysis
Markdown < a > tag new page open link
After route link navigation, the sub page does not display the navigation style problem
LeetCode动态规划训练营(1~5天)
JDBC database addition, deletion, query and modification tool class