一品网
  • 首页

L1-046 整除光棍 (20 分)


这题实际上是模拟除法;上马原课的时候领悟到了,hh

#include 
using namespace std;
int main()
{
    int x;
    cin >> x;
    int ans = 0, cnt = 0;
    while(ans < x)
    {
        ans = ans * 10 + 1;
        cnt++;
    }
    while(1)
    {
        cout << ans / x;
        ans = ans % x;
        if(ans == 0) break;
        ans = ans * 10 + 1;
        cnt++;
    }
    cout << ' ' << cnt;
    return 0;
}
题目&amp题解PTA题集模拟

相关


使用webgl(three.js)搭建一个3D智慧园区、3D建筑,3D消防模拟,web版3D,bim管理系统——第

noip多校模拟30

2019.11.8模拟赛

[NOIP模拟赛] 2021.11.16

20211116 NOIP 模拟赛

项目实战:Qt+C#轨道交通行业高性能高流畅度模拟火车移动图像控件

ASP.NET Core管道深度剖析(2):创建一个“迷你版”的管道来模拟真实管道请求处理流程

NOIP模拟99(多校31)

20210628模拟赛解题报告

20201115gryz模拟赛解题报告

N体模拟数据可视化 LightningChart®

Noip模拟91 2021.11.6

标签

一品网 冀ICP备14022925号-6