LIGHTOJ-1078 - Integer Divisibility

高一数学必修三BASIC 语言实现平台以及书中代码 高一数学必修三第一章内容为算法初步,其中程序语言为BASIC平台编程实现,由于这门语言比较古老,因此很难找到可以运行的版本,我也是找了很久,并且在Win7,XP系统上经过测试都可以正常运行。并且我把书中例子也做了编程,再次分享,希望对学习这门课程的老是同学有所帮助! 立即下载

1078 - Integer Divisibility
Time Limit: 2 second(s)Memory Limit: 32 MB

If an integer is not divisible by 2 or 5, some multiple of that number in decimal notation is a sequence of only a digit. Now you are given the number and the only allowable digit, you should report the number of digits of such multiple.

For example you have to find a multiple of 3 which contains only 1's. Then the result is 3 because is 111 (3-digit) divisible by 3. Similarly if you are finding some multiple of 7 which contains only 3's then, the result is 6, because 333333 is divisible by 7.

Input

Input starts with an integer T (≤ 300), denoting the number of test cases.

Each case will contain two integers n (0 < n ≤ 106 and n will not be divisible by 2 or 5) and the allowable digit (1 ≤ digit ≤ 9).

Output

For each case, print the case number and the number of digits of such multiple. If several solutions are there; report the minimum one.

Sample Input

Output for Sample Input

3

3 1

7 3

9901 1

Case 1: 3

Case 2: 6

Case 3: 12





求几个一位数能被第一个数整除,模拟两数相除的过程!



#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	int i,j,k,a,b,m,n,num1,num2,cot=1;;
	scanf("%d",&n);
	
	while(n--)
	{
		num1=0;
		num2=0;
		scanf("%d%d",&a,&b);
		int x=a,y=b;
		while(x>y)
		{
			y=y*10+b;
			num2++;
		}
		
		while(y%x)
		{
			y=(y%x)*10+b;
			num1++;
		}
		printf("Case %d: %d\n",cot++,num1+num2+1);
	}
	return 0;
}

怀旧BASIC程序 很早很早以前,学计算机的都在学习BASIC,还有人记得吗? 据说有一种还能直接将源程序编译成EXE的,真叫人激动………… 内有两个:GWBASIC和Turbo Basic。 有兴趣的收藏一下也好。 立即下载

相关推荐

基于高精度三维机器视觉的新能源汽车锂电池表面缺陷检测

在机器视觉行业迅速发展的背景下,市场上提供了功能强大且种类齐全的3D相机系列,可以满足锂电池从电芯到模组各个工艺和工位的3D检测需求。

Hinyeung_Limited的博客 1131

lightoj1078 - Integer Divisibility

1078 - Integer Divisibility PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB If an integer is not divisible by 2 or 5, some multiple

走一步再走一步 690

FPGA时序分析中的工艺角:从PVT原理到建立保持时间验证

在数字电路设计中,静态时序分析(STA)是确保芯片功能正确和性能达标的核心验证手段。其基本原理是通过计算信号在逻辑路径上的传播延迟,检查建立时间和保持时间是否满足寄存器采样要求。这项技术的核心价值在于,它能在芯片制造前就预测并消除时序违规,极大提高设计成功率。然而,实际芯片性能会受到工艺波动、电压变化和温度漂移(合称PVT)的显著影响。为了覆盖这些不确定性,时序分析必须采用基于工艺角的边界模型——用最慢的工艺角模型验证建立时间,用最快的工艺角模型验证保持时间。这种分析方法广泛应用于FPGA和ASIC设计流程

weixin_30181209的博客 196

LightOJ 1078 [同余]

同余 (digit∗10+digit) % mod=(digit∗10)%mod+digit % mod(digit * 10 + digit)\ \%\ mod = (digit * 10) \% mod + digit\ \%\ mod(digit∗10+digit) % mod=(digit∗10)%mod+digit % mod

m0_60593173的博客 167

AlphaPose复现配置教程

AlphaPose是一种准确的多人姿态估计器,这是第一个在COCO数据集上达到70+ mAP (75 mAP)和在MPII数据集上达到80+ mAP (82.1 mAP)的开源系统。为了匹配跨帧的同一人的姿态,我们还提供了一种高效的在线姿态跟踪器,称为Pose Flow。这是第一个在PoseTrack挑战数据集上达到60+ mAP (66.5 mAP)和50+ MOTA (58.3 MOTA)的开源在线姿态跟踪器。AlphaPose支持Linux和Windows操作系统!指路👉。

m0_56661101的博客 4527

FPGA中的CMAC硬核与Interlaken硬核

CMAC硬核和Interlaken硬核是FPGA中两种重要的内置功能模块,它们分别在CNN推理和高带宽芯片到芯片接口方面发挥着关键作用。FPGA(Field Programmable Gate Array,现场可编程逻辑门阵列)中的CMAC硬核与Interlaken硬核是两种重要的内置功能模块,它们在FPGA设计中扮演着关键角色。需要注意的是,FPGA设计中的硬核选择不仅取决于硬核本身的性能,还需要考虑硬核与FPGA芯片其他部分的兼容性、功耗、成本等因素。Interlaken硬核。

weixin_41230430的博客 1481

Java 两个integer类型的数据相除总是得到0

解决办法:在其中一个integer类型数据加上(float) ,强转一下,如果对精度没要求的话

qq_33626315的博客 2569

新手也能写复杂爬虫!AI+Python自动分析京东商品,提取数据不用F12

不用F12:AI自动分析京东页面,生成选择器;不用懂JS:Playwright自动渲染动态数据;不用改代码:只需配置3个参数,复制运行就能出结果。这套方案不仅适用于京东,修改提示词后还能爬取淘宝、拼多多、亚马逊等电商网站,新手只需掌握“配置参数→运行代码→查看CSV”3步,就能轻松获取任意网站的结构化数据。未来,AI会让爬虫彻底进入“零代码、零门槛”时代,新手也能轻松搞定复杂数据爬取需求。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1340

两个integer进行除法操作,得到小数

package com.lysf.project.ilab.utils; import java.math.BigDecimal; public class DoubleUtils { public static double deciMal(int top, int below) { double result = new BigDecimal((float)top / below).setScale(4, BigDecimal.ROUND_HALF_UP).double.

qq_40180411的博客 4680

C#图像处理:OpenCVSharp实现简单人脸识别

人脸识别是计算机视觉领域中的一个重要研究方向,它可以通过分析和比对人脸图像,实现识别和验证的功能。希望通过这篇文章的学习,你对OpenCVSharp和人脸识别有了初步的了解,并能够运用这些知识进行自己的项目开发。当我们运行程序时,它会加载人脸识别模型并读取待识别的图像,然后进行人脸检测并在图像上标记出检测到的人脸位置。当然,这只是一个入门级的示例,实际的人脸识别系统还需要更加复杂的算法和大量的训练数据来提高准确性和鲁棒性。最后,我们遍历检测到的人脸,并在原始图像上绘制矩形框,标记出检测到的人脸位置。

WELL_CODER的博客 1129

github创建账号第一步始终出错

github创建账号总结:第一次注册GitHub,填好用户名邮箱密码后进入下一步就卡在哪里,上面还提示Unable to verify your captcha response等,进入网址的解决办法以及下载其他的浏览器也无法解决,用手机浏览器抱着试一试的心态竟然成功了,分享给大家。手机下载谷歌浏览器,进入GitHub正常注册,能向下继续,邮箱验证完以后再用电脑登陆就ok啦

计算机毕业论文源码,学生个人网页制作html源码。贴近用户做网络推广和互联网优化。 4373

OJ : 1078:a+b(多实例测试1)

OJ :1078 : a+b(多实例输出1)

2302_80025181的博客 468

SI案例分享--考虑ESD保护二极管的差分线阻抗仿真

PCB设计中的cut out参考面早已是SI评估中常用的阻抗优化方式,通过合理的仿真建模,可以提供合适的设计参考,并保持与测试结果的高度一致性。

一只豌豆象的博客 1436

LightOJ-1078 Integer Divisibility

D - F是签到题Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu SubmitStatusPracticeLightOJ 1078uDebug Description If an integer is not divisible by 2 or 5, some multiple of that

DTL66的博客 606

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

LightOJ 1078 Integer Divisibility (同余定理)

LightOJ - 1078  题目: If an integer is not divisible by 2 or 5, some multiple of that number in decimal notation is a sequence of only a digit. Now you are given the number and the only allowable digi...

pxlsdz的博客 468

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

lightoj 1078 - Integer Divisibility 【同余】

1078 - Integer Divisibility PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB If an integer is not divisible by 2 or 5, some multiple

世界很大 646

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

Integer Divisibility(LightOJ-1078)

Problem Description If an integer is not divisible by 2 or 5, some multiple of that number in decimal notation is a sequence of only a digit. Now you are given the number and the only allowable digi...

Alex_McAvoy的博客 297

Integer Divisibility LightOJ - 1078

If an integer is not divisible by 2 or 5, some multiple of that number in decimal notation is a sequence of only a digit. Now you are given the number and the only allowable digit, you should report t...

wait 177

lightoj 1078 - Integer Divisibility 【同余定理】

1078 - Integer Divisibility PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB If an integer is not divisible by 2 or 5, some multiple

longge33445的博客 293

LightOJ 1078 Integer Divisibility (同余定理)

Integer Divisibility(答题) Time Limit: 2000MS Memory Limit: 32768KB 64bit IO Format: %lld & %llu Submit Status uDebug Description If an integer is notdivisible by 2 or

Shyazhut 533

lightoj 1078 - Integer Divisibility 暴力数学

给定一个n和x,问最少多少个x组成的数字可以整除n... 直接暴力,依次枚举x的数量... 因为没想到其他做法只能尝试暴力了..没想到过了。 大概是如果有解的话余数最多出现n个...所以n次内必然有解?n*t貌似不超时 #include using namespace std; #define ll long long #define ull unsigned long long #def

368

【简单】LightOJ Integer Divisibility 1078

1078 - Integer Divisibility PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB If an integer is not divisible by 2 or 5, some multiple

豫帝哥哥 581

LightOJ 1078 - Integer Divisibility【同余】

If an integer is not divisible by 2 or 5, some multiple of that number in decimal notation is a sequence of only a digit. Now you are given the number and the only allowable digit, you should report the number of digits of such multiple. For example you h

小I的博客 435

【 LightOJ 1078 Integer Divisibility + 同余定理 】

Description If an integer is not divisible by 2 or 5, some multiple of that number in decimal notation is a sequence of only a digit. Now you are given the number and the only allowable digit, you sho

楚江枫 491

LightOJ1078 Integer Divisibility(同余定理)

Description If an integer is not divisible by 2 or 5, some multiple of that number in decimal notation is a sequence of only a digit. Now you are given the number and the only allowable digit, you sh

菜鸟的自我修养 412
上一篇: LIGHTOJ-10081008 - Fibsieve`s Fantabulous Birthday(规律)
下一篇: LIGHTOJ-1116 - Ekka Dokka
Eric_keke
博客等级 码龄12年 37粉丝 221原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值