HDU1898 Sempr == The Best Problem Solver?【水题】

Sempr == The Best Problem Solver?


Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 1317    Accepted Submission(s): 865

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分钟,谁做的比较多。

思路:直接比较谁剩的多就可以了,水的不能再水了。。。


#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
    int T,A,B,N;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d%d%d",&A,&B,&N);
        int a = N%A,b = N%B;
        if(a == b)
            printf("Both!\n");
        else if(a < b)
            printf("Sempr!\n");
        else
            printf("Xiangsanzi!\n");
    }
    
    return 0;
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值