HDOJ(HDU) 1898 Sempr == The Best Problem Solver?(水题、、、)

时间:2023-02-18 23:28:49

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?(水题、、、)的更多相关文章

  1. hdoj 1898 Sempr &equals;&equals; The Best Problem Solver&quest;

    Sempr == The Best Problem Solver? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/3276 ...

  2. HDOJ&sol;HDU 1256 画8&lpar;绞下思维~水题&rpar;

    Problem Description 谁画8画的好,画的快,今后就发的快,学业发达,事业发达,祝大家发,发,发. Input 输入的第一行为一个整数N,表示后面有N组数据. 每组数据中有一个字符和一 ...

  3. HDOJ&lpar;HDU&rpar; 2061 Treasure the new start&comma; freshmen&excl;&lpar;水题、&rpar;

    Problem Description background: A new semester comes , and the HDU also meets its 50th birthday. No ...

  4. HDU 4716 A Computer Graphics Problem (水题)

    A Computer Graphics Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (J ...

  5. fzuoj Problem 2182 水题

    http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188    Submit: 277Time Limit: 100 ...

  6. hdu 2393&colon;Higher Math(计算几何,水题)

    Higher Math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  7. &lt&semi;hdu - 3999&gt&semi; The order of a Tree 水题 之 二叉搜索的数的先序输出

    这里是杭电hdu上的链接:http://acm.hdu.edu.cn/showproblem.php?pid=3999  Problem Description: As we know,the sha ...

  8. 烟大 Contest1024 - 《挑战编程》第一章:入门 Problem A&colon; The 3n &plus; 1 problem(水题)

    Problem A: The 3n + 1 problem Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 14  Solved: 6[Submit][St ...

  9. hdu 1164&colon;Eddy&&num;39&semi;s research I(水题,数学题,筛法)

    Eddy's research I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

随机推荐

  1. ASP常用函数

    取得IP地址 '******************************************************************* Function Userip() Dim Ge ...

  2. 零售ERP开发(一)

    随着企业信息化不断提高,各种企业管理系统应用而生:怎么才能开发一套简洁.易用.功能健全的管理系统,尤其是能够帮助企业做出重大策略的系统,一致是我们追求的目标.近些年,接触的Erp系统主要包括国内比较知 ...

  3. tbschedule

    tbschedule 此文档内部包括:1.设计目标说明2.主要概念解释3.涉及的数据对象说明4.涉及的业务接口说明5.Sleep模式和NotSleep模式的区别6.使用过程中的注意事项 1.调度器的设 ...

  4. golang环境 centos 7

    https://blog.csdn.net/ggq89/article/details/82682171  Linux下Go的安装.配置 .升级和卸载 https://blog.csdn.net/we ...

  5. Python智能检测编码并转码

    #安装包工具 $pip3 install chardet #直接打开文件,中文显示乱码 >>> import chardet >>> f = open('test. ...

  6. Codeforces Round &num;439 &lpar;Div&period; 2&rpar; A B C

    强哉qls,这场div2竟是其出的!!! A. The Artful Expedient 暴力 ^ ,判断是否出现,有大佬根据亦或的性质推出 Karen 必赢,太强啦23333333333333. # ...

  7. F2eTest程序快捷方式安装到桌面

      按照http://f2etest.***.com/install页面上介绍的:安装快捷方式到Windows桌面 (Win7)部分的介绍进行安装. 其中第三步的https连接需要在f2etest的c ...

  8. 跟上Java8 - 日期和时间实用技巧

    原文出处:王爵nice 当你开始使用Java操作日期和时间的时候,会有一些棘手.你也许会通过System.currentTimeMillis() 来返回1970年1月1日到今天的毫秒数.或者使用Dat ...

  9. 【POJ】1740&period;A New Stone Game

    题解 想去学习一下博弈论的SG函数 不过貌似这道题就是猜结论并且证明 题意是,随便选择一堆石子,扔掉至少一个,然后从扔石子的这堆里选择任意多(可以不选)放到其他任意多的未选择完的石堆里 一堆石子,先手 ...

  10. unity 2018获取本地ip 问题,ipaddress

    Network.Player.ipAddress这个API在Unity2018被移除了 用如下代码 using System.Net; using System.Net.NetworkInformat ...