hdu-5640 King's Cake (水题)
题目链接
King's Cake
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 79 Accepted Submission(s): 69
For each testcase, the first line and the only line contains two positive numbers n,m(1≤n,m≤10000).
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,m;
scanf("%d%d",&n,&m);
int ans=,mmin,mmax;
while(n&&m)
{
if(n>m)
{
n-=m;
}
else
{
m-=n;
}
ans++;
}
cout<<ans<<"\n"; }
return ;
}
hdu-5640 King's Cake (水题)的更多相关文章
- HDU 5640 King's Cake GCD
King's Cake 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5640 Description It is the king's birthd ...
- HDU 5640 King's Cake
King's Cake Problem Description It is the king's birthday before the military parade . The ministers ...
- hdu 5640 King's Cake(BestCoder Round #75)
King's Cake Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total ...
- hdu 5640 King's Cake(模拟)
Problem Description It is the king's birthday before the military parade . The ministers prepared ...
- HDU 5640 King's Cake【模拟】
题意: 给定长方形,每次从中切去一个最大的正方形,问最终可以得到多少正方形. 分析: 过程类似求gcd,每次减去最小的边即可. 代码: #include <cstdio> #include ...
- HDU 5578 Friendship of Frog 水题
Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- HDU 5590 ZYB's Biology 水题
ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- Codeforces Round #343 (Div. 2) A. Far Relative’s Birthday Cake 水题
A. Far Relative's Birthday Cake 题目连接: http://www.codeforces.com/contest/629/problem/A Description Do ...
随机推荐
- 【Atheros】网卡驱动速率调整算法概述
我做网卡驱动,最主要的内容就是设计和改进速率调整算法,随着802.11协议簇的新标准越来越多,速率越来越高,调制编码方式也越来越多,一般来说,速率越高越可能丢包,速率越低越稳定,这是整体状况,但不是必 ...
- STM32 Option Bytes位 重置为出厂设置
STM32 Option Bytes位 重置为出厂设置 JLINK 按照说明,在IAR安装目录下找到指定的运行程序JLinkSTM32.exe(D:\Program Files (x86)\IAR S ...
- WPF中的数据模板使用方式之一:ContentControl、ContentTemplate和TemplateSelector的使用
在WPF中,数据模板是非常强大的工具,他是一块定义如何显示绑定的对象的XAML标记.有两种类型的控件支持数据模板:(1)内容控件通过ContentTemplate属性支持数据模板:(2)列表控件通过I ...
- Linux时间时区详解与常用时间函数
时间与时区 整个地球分为二十四时区,每个时区都有自己的本地时间. Ø UTC时间 与 GMT时间 我们可以认为格林威治时间就是时间协调时间(GMT = UTC),格林威治时间和UTC时间都用秒数来计 ...
- swift中的?和!理解
本文转载至 http://www.cnblogs.com/dugulong/p/3770367.html 首先贴cocoachina上某位大大的帖子: Swift语言使用var定义变量,但和别 ...
- 【BZOJ3926】[Zjoi2015]诸神眷顾的幻想乡 广义后缀自动机
[BZOJ3926][Zjoi2015]诸神眷顾的幻想乡 Description 幽香是全幻想乡里最受人欢迎的萌妹子,这天,是幽香的2600岁生日,无数幽香的粉丝到了幽香家门前的太阳花田上来为幽香庆祝 ...
- openssl将私钥和crt证书合成pfx证书
pfx是什么文件:公钥加密技术12号标准(Public Key Cryptography Standards #12,PKCS#12)为存储和传输用户或服务器私钥.公钥和证书指定了一个可移植的格式.它 ...
- windowsphone8.1学习笔记之应用数据(四)
应用数据的存储格式常用的分为json和xml两种(其实我都想略过这个地方的,json我一直用的是json.net,而wp上操作xml的方式与其他相比也没太多变化). 先说说json数据存储,关于jso ...
- java的小知识点
1 获取当前路径 System.getProperty("user.dir") System.getProperty()参数大全# java.version ...
- PhotoKit详解
Photokit介绍 这篇主要介绍如何通过 Photokit获取数据 photokit.jpg 1,基类 PHObject Photos 框架中的根类PHObject只有一个公开接口 localIde ...