HDOJ(HDU) 1898 Sempr == The Best Problem Solver?(水题、、、)
Problem Description
As is known to all, Sempr(Liangjing Wang) had solved more than 1400 problems on POJ, but nobody know the days and nights he had spent on solving problems.
Xiangsanzi(Chen Zhou) was a perfect problem solver too. Now this is a story about them happened two years ago.
On March 2006, Sempr & Xiangsanzi were new comers of hustacm team and both of them want to be “The Best New Comers of March”, so they spent days and nights solving problems on POJ.
Now the problem is below: Both of them are perfect problem solvers and they had the same speed, that is to say Sempr can solve the same amount of problems as Xiangsanzi, but Sempr enjoyed submitting all the problems at the end of every A hours but Xiangsanzi enjoyed submitting them at the end of every B hours. In these days, static(Xiaojun Wu) was the assistant coach of hustacm, and he would check the number of problems they solved at time T. Give you three integers A,B,and T, you should tell me who is “The Best New Comers of March”. If they solved the same amount of problems, output “Both!”. If Sempr or Xiangsanzi submitted at time T, static would wait them.
Input
In the first line there is an integer N, which means the number of cases in the data file, followed by N lines.
For each line, there are 3 integers: A, B, T.
Be sure that A,B and N are no more than 10000 and T is no more than 100000000.
Output
For each case of the input, you should output the answer for one line. If Sempr won, output “Sempr!”. If Xiangsanzi won, output “Xiangsanzi!”. And if both of them won, output “Both!”.
Sample Input
3
2 3 4
2 3 6
2 3 9
Sample Output
Sempr!
Both!
Xiangsanzi!
就是输入a b t。
Sempr在每过a个时间提交一次代码,
Xiangsanzi在每过b个时间提交一次代码,
问在t时间内,谁提交的代码量多。
注意,他们编程速度什么的都是一样的!每时每刻都在编程!是提交的代码量谁多一些!
也就是说,看他们最后一次提交代码,谁距离t时间最近,谁就提交的多。
实际上就是a%t,b%t的余数来比较大小,谁的余数小,就输出谁。
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int t =sc.nextInt();
while(t-->0){
int a = sc.nextInt();
int b =sc.nextInt();
int tm = sc.nextInt();
if(tm%a==tm%b){
System.out.println("Both!");
continue;
}
if(tm%a<tm%b){
System.out.println("Sempr!");
continue;
}
System.out.println("Xiangsanzi!");
}
}
}
HDOJ(HDU) 1898 Sempr == The Best Problem Solver?(水题、、、)的更多相关文章
- hdoj 1898 Sempr == The Best Problem Solver?
Sempr == The Best Problem Solver? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/3276 ...
- HDOJ/HDU 1256 画8(绞下思维~水题)
Problem Description 谁画8画的好,画的快,今后就发的快,学业发达,事业发达,祝大家发,发,发. Input 输入的第一行为一个整数N,表示后面有N组数据. 每组数据中有一个字符和一 ...
- HDOJ(HDU) 2061 Treasure the new start, freshmen!(水题、)
Problem Description background: A new semester comes , and the HDU also meets its 50th birthday. No ...
- HDU 4716 A Computer Graphics Problem (水题)
A Computer Graphics Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (J ...
- fzuoj Problem 2182 水题
http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188 Submit: 277Time Limit: 100 ...
- hdu 2393:Higher Math(计算几何,水题)
Higher Math Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- <hdu - 3999> The order of a Tree 水题 之 二叉搜索的数的先序输出
这里是杭电hdu上的链接:http://acm.hdu.edu.cn/showproblem.php?pid=3999 Problem Description: As we know,the sha ...
- 烟大 Contest1024 - 《挑战编程》第一章:入门 Problem A: The 3n + 1 problem(水题)
Problem A: The 3n + 1 problem Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 14 Solved: 6[Submit][St ...
- hdu 1164:Eddy's research I(水题,数学题,筛法)
Eddy's research I Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
随机推荐
- 用crontab设置svn的定期更新任务
本以为用crontab设置svn的定期更新任务是件非常容易的事情,实践后方才知道,其实并不那么容易.设置例行性工作如下:0 8 * * * /usr/bin/svn up /data/test第二天, ...
- [转] boost------ref的使用(Boost程序库完全开发指南)读书笔记
http://blog.csdn.net/zengraoli/article/details/9663057 STL和Boost中的算法和函数大量使用了函数对象作为判断式或谓词参数,而这些参数都是传值 ...
- 在ASP.NET将程序中将上传的附件存储到另一台文件服务器上的实现
假定有两台服务器:A和B,其中A为Web服务器(IP:192.123.1.1, 为iis发布程序的服务器 ),B为文件服务器(IP: 192.123.2.2) 在文件服务器B中某个磁盘下创建一个共享文 ...
- B/S 獲取客戶端Mac地址
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx. ...
- C++ Primer 5th 第13章 拷贝控制
当一个对象的引用或者指针离开作用域时,析构函数不会执行. 构造函数有初始化部分(初始化列表)和函数体. 析构函数有析构部分和函数,但析构函数的析构部分是隐式的.
- mysql报Fatal error encountered during command execution的解决办法
连接字符串里加上 Allow User Variables=True 解决. 否则时不时的报错,存储过程名长一点也报错,又有时报有时不报,参数传1位数就正常2位数就报错等…… 折腾mysql蛋疼啊
- javascript获得给定日期的前一天的日期
/** * 获得当前日期的前一天 */ function getYestoday(date){ var yesterday_milliseconds=date.getTime()-1000*60*60 ...
- java保留两位小数的方法
01.import java.math.BigDecimal; 02.import java.text.DecimalFormat; 03.import java.text.NumberFormat; ...
- canvas 背景填充
这儿介绍canvas的ccreatePattern函数, context.createPattern(Image,"repeat"),还可以repeat-x,reapter-y 还 ...
- HTML5 input控件 placeholder属性
placeholder 属性提供可描述输入字段预期值的提示信息(hint),该提示会在输入字段为空时显示,并会在字段获得焦点时消失. <input placeholder="请输入姓名 ...