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 ...
随机推荐
- Java对存储过程的调用方法 --转载
一.Java如何实现对存储过程的调用: A:不带输出参数的 create procedure getsum <--此处为参数--> as declare @sum int<--定义变 ...
- ASP.NET过滤器、URL重写
过滤器可以对指定的URL访问进行拦截,并执行过滤器的方法,根据实际应用情况,在过滤器中修改请求的代码.判断会话信息,也可以做权限控制. 一:编写过滤器,实现URL重写并配置过滤 编写过滤器,就是编写一 ...
- ViewPagerindicator 源码解析
ViewPagerindicator 源码解析 1. 功能介绍 1.1 ViewPagerIndicator ViewPagerIndicator用于各种基于AndroidSupportL ...
- 13、SQL Server 自定义函数
SQL Server 自定义函数 在SQL Server中不仅可以使用系统函数(如:聚合函数,字符串函数,时间日期函数等)还可以根据需要自定义函数. 自定义函数分为标量值函数和表值函数. 其中,标量值 ...
- dedecms调用所有顶级栏目最新文章的实现方法
做dedecms的模板,我们会遇到各种各样的调用问题,dedecms列表页调用所有顶级栏目文章列表的方法如下所述: 在文章页面经常使用的是 {dede:arclist orderby='pubdate ...
- redisbook笔记——redis内部数据结构
在Redis的内部,数据结构类型值由高效的数据结构和算法进行支持,并且在Redis自身的构建当中,也大量用到了这些数据结构. 这一部分将对Redis内存所使用的数据结构和算法进行介绍. 动态字符串 S ...
- java 安卓开发之文件的读与写
java文件的读与写,代码: String file="user.txt"; private void writeFileData(String str1, String str2 ...
- 低字节序和高字节序相互转换(Little Endian/Big Endian)
这个例子展示了如何转换整形数字的字节顺序,该方法可以用来在little-endian和big-endian之间转换. 说明:Windos(x86,x64)和Linux(x86,x64)都是little ...
- 限制窗口拉伸范围——WM_GETMINMAXINFO
注意:此方法对CListCtrl的Report模式下的表头绘制有影响,用时需注意测试! 使用OnSizing的改进版 该例程用处为将窗口限制了大小,并且只允许上下拉伸.需要注意的是WM_GETMINM ...
- 【USACO 2.4.2】穿越栅栏
[描述] 农夫John在外面的田野上搭建了一个巨大的用栅栏围成的迷宫.幸运的是,他在迷宫的边界上留出了两段栅栏作为迷宫的出口.更幸运的是,他所建造的迷宫是一个“完美的”迷宫:即你能从迷宫中的任意一点找 ...