FZU 2147 A-B Game
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Description
Fat brother and Maze are playing a kind of special (hentai) game by two integers A and B. First Fat brother write an integer A on a white paper and then Maze start to change this integer. Every time Maze can select an integer x between 1 and A-1 then change A into A-(A%x). The game ends when this integer is less than or equals to B. Here is the problem, at least how many times Maze needs to perform to end this special (hentai) game.
Input
The first line of the date is an integer T, which is the number of the text cases.
Then T cases follow, each case contains two integers A and B described above.
1 <= T <=100, 2 <= B < A < 100861008610086
Output
For each case, output the case number first, and then output an integer describes the number of times Maze needs to perform. See the sample input and output for more details.
Sample Input
Sample Output
#include <stdio.h>
#include <string.h>
int main()
{
int T;
int ca=;
int i,j,k;
long long a,b;
scanf("%d",&T);
while(T--)
{
int num=;
scanf("%I64d %I64d",&a,&b);
while(a>b)
{
a=a/+;
num++;
}
printf("Case %d: %d\n",ca,num);
ca++;
}
return ;
}
FZU 2147 A-B Game的更多相关文章
- FZU 2147 A-B Game(数学)
我们只需要知道这个取完模最大是 a / 2 + 1就可以了,不过超时了几次,换了visual C++才过,oj还真是傲娇啊. #include<iostream> #include< ...
- FZU 2137 奇异字符串 后缀树组+RMQ
题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...
- FZU 1914 单调队列
题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...
- ACM: FZU 2105 Digits Count - 位运算的线段树【黑科技福利】
FZU 2105 Digits Count Time Limit:10000MS Memory Limit:262144KB 64bit IO Format:%I64d & ...
- codev 2147 数星星
2147 数星星 http://codevs.cn/problem/2147/ 题目描述 Description 小明是一名天文爱好者,他喜欢晚上看星星.这天,他从淘宝上买下来了一个高级望远镜.他十分 ...
- FZU 2112 并查集、欧拉通路
原题:http://acm.fzu.edu.cn/problem.php?pid=2112 首先是,票上没有提到的点是不需要去的. 然后我们先考虑这个图有几个连通分量,我们可以用一个并查集来维护,假设 ...
- ACM: FZU 2107 Hua Rong Dao - DFS - 暴力
FZU 2107 Hua Rong Dao Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I6 ...
- ACM: FZU 2112 Tickets - 欧拉回路 - 并查集
FZU 2112 Tickets Time Limit:3000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u P ...
- ACM: FZU 2102 Solve equation - 手速题
FZU 2102 Solve equation Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & ...
随机推荐
- dubbo 学习
1. dubbo Can not lock the registry cache file: 当本地同时启动服务端和客户端的时候就可能产生这个问题. 解决方案 Dubbo通过注册中心发现服务,发现的服 ...
- pybot/robot命令参数说明
Robot Framework -- A generic test automation framework Version: 3.0 (Python 3.4.0 on win32) Usage: r ...
- 161111、NioSocket的用法(new IO)
今天先介绍NioSocket的基本用法,实际使用一般会采用多线程,后面会介绍多线程的处理方法. 从jdk1.4开始,java增加了新的io模式--nio(new IO),nio在底层采用了新的处理方式 ...
- uboot启动参数
bootcmd=nand read.jffs2 0x30007FC0 kernel; bootm 0x30007FC0bootdelay=2baudrate=115200ethaddr=08:00:3 ...
- 各种数据库连接代码(java)
SqlServer2000 Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); URL = "j ...
- Loadrunner 接口测试的两种方法
其实无论用那种测试方法,接口测试的原理是通过测试程序模拟客户端向服务器发送请求报文,服务器接收请求报文后对相应的报文做出处理然后再把应答报文发送给客户端,客户端接收应答报文这一个过程. 方法一.用Lo ...
- Spring的javaMail邮件发送(带附件)
项目中经常用到邮件功能,在这里简单的做一下笔记,方便日后温习. 首先需要在配置文件jdbc.properties添加: #------------ Mail ------------ mail.smt ...
- The reference to entity “idNo” must end with the ';' delimiter 异常处理
解决方案很简单,就是把配置项值中用到"&"的地方改成"&".原因是sax解析的类库在读取文件的时候是根据转义后的格式进行读取的,遇到" ...
- JavaEE基础(十三)
1.常见对象(StringBuffer类的概述) A:StringBuffer类概述 通过JDK提供的API,查看StringBuffer类的说明 线程安全的可变字符序列 B:StringBuffer ...
- ug-Assertion failure in [MyClass layoutSublayersOfLayer:]
这是在iOS7上,tableview 的sectionHeaderView中报错 *** Assertion failure in -[****.****UITVSectionHeader_Team ...