Julyed
Time Limit: 2000MS Memory Limit: 65536KB
提交统计 讨论
Problem Description
问题描述
Julyed is preparing for her CET-6. Shehas N words to remember, but there is only M days
小明 正在准备他的英语六级考试 他有N个单词需要记住 但是这里只剩下M天
left. If she can’t remember all thesewords, she won’t pass CET-6. If she can’t pass
如果所有这些单词 他将不会通过英语六级 如果她不能通过英语六级
CET-6, she will be unhappy. But if sheremember too many words in one day, she will be
他将不开心 但是如果她在一天记住太多单词 他将也不开心
unhappy, too. If she is unhappy,tomriddly will be unhappy. So she will remember as
如果她不开心 他男朋友 将不开心 所以他将 尽可能 在一天里记得少
little words as she can in one day.For the happiness of both tomriddly and Julyed, how
为了他和他男朋友的开心
many words at most will Julyedremember in one day?
小名将要最多在一天里记住多少单词
Input
Multipletest cases. The first line is an integer T (T <= 10000),
多个测试用例 第一行是一个整数T(T<=10000)
indicating the number of test cases.
表明这个测试用例的数量
Each test case is a line with twointegers N, M (1 <= N, M <=
每一个测试样例都是一行包含两个整数N,M(1<=N,M<=200)
200), indicating the number of wordsto remember and the number of days left.
分别表明单词数量和剩下的天数
Output
One line per case, an integer indicates the answer.
每一个样例输出一个整数答案
Example Input
输入例子
5
6 3
2 1
1 2
5 2
4 3
Example Output
输出例子
2
2
1
3
2
Hint
暗示
Author
作者
“浪潮杯”山东省第七届ACM大学生程序设计竞赛
分析:分母为零不需要考虑,有两种情况1是单词数目恰好能被天数整除这就是最大数目了 如果不能整除 就在整除的基础上加1
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int a,b;
int n;
cin>>n;
while(n--)
{
cin>>a>>b;
if(a%b!=0)
{
cout<<a/b+1;
}
else
{
cout<<a/b;
}
cout<<endl;
}
return 0;
}