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

简介: 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!");
        }
    }
}
目录
相关文章
codeforces 285C - Building Permutation
题目大意是有一个含n个数的数组,你可以通过+1或者-1的操作使得其中的数是1--n中的数,且没有重复的数。 既然是这样的题意,那么我就应该把原数组中的数尽量往他最接近1--n中的位置放,然后求差绝对值之和,但有多个数,怎么使他们和最小,这样就要对其进行排序了,直接按大小给它们安排好位置,然后计算。
38 0
|
C++
【PAT甲级 - C++题解】1108 Finding Average
【PAT甲级 - C++题解】1108 Finding Average
77 0
HDOJ/HDU 1022 Train Problem I(模拟栈)
HDOJ/HDU 1022 Train Problem I(模拟栈)
126 0
HDOJ/HDU 1022 Train Problem I(模拟栈)
HDOJ 1016 Prime Ring Problem素数环【深搜】
HDOJ 1016 Prime Ring Problem素数环【深搜】
121 0
HDOJ 1016 Prime Ring Problem素数环【深搜】
HDOJ(HDU) 2309 ICPC Score Totalizer Software(求平均值)
HDOJ(HDU) 2309 ICPC Score Totalizer Software(求平均值)
107 0
HDOJ(HDU) 2148 Score(比较、)
HDOJ(HDU) 2148 Score(比较、)
107 0
|
Go
HDOJ/HDU 1085 Holding Bin-Laden Captive!(非母函数求解)
HDOJ/HDU 1085 Holding Bin-Laden Captive!(非母函数求解)
117 0
HDOJ(HDU) 1673 Optimal Parking
HDOJ(HDU) 1673 Optimal Parking
130 0
|
Go
HDOJ(HDU) 1977 Consecutive sum II(推导、、)
HDOJ(HDU) 1977 Consecutive sum II(推导、、)
113 0
|
Java 文件存储
HDOJ(HDU) 2132 An easy problem
HDOJ(HDU) 2132 An easy problem
115 0

热门文章

最新文章