Sempr == The Best Problem Solver?

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

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!
 
#include<stdio.h>
int main()
{
int n,a,b,t;
int suma,sumb;
scanf("%d",&n);
while(n--)
{
scanf("%d%d%d",&a,&b,&t);
suma=a*(t/a);
sumb=b*(t/b);
if(suma==sumb)
printf("Both!\n");
else if(suma<sumb)
printf("Xiangsanzi!\n");
else if(suma>sumb)
printf("Sempr!\n");
}
return 0;
}

  

hdoj 1898 Sempr == The Best Problem Solver?的更多相关文章

  1. 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 ...

  2. 水题 HDOJ 4716 A Computer Graphics Problem

    题目传送门 /* 水题:看见x是十的倍数就简单了 */ #include <cstdio> #include <iostream> #include <algorithm ...

  3. DFS+剪枝 HDOJ 5323 Solve this interesting problem

    题目传送门 /* 题意:告诉一个区间[L,R],问根节点的n是多少 DFS+剪枝:父亲节点有四种情况:[l, r + len],[l, r + len - 1],[l - len, r],[l - l ...

  4. HDOJ(HDU).1016 Prime Ring Problem (DFS)

    HDOJ(HDU).1016 Prime Ring Problem (DFS) [从零开始DFS(3)] 从零开始DFS HDOJ.1342 Lotto [从零开始DFS(0)] - DFS思想与框架 ...

  5. mutiset HDOJ 5349 MZL's simple problem

    题目传送门 /* 这题可以用stl的mutiset容器方便求解,我对这东西不熟悉,TLE了几次,最后用读入外挂水过. 题解有O(n)的做法,还以为我是侥幸过的,后来才知道iterator it写在循环 ...

  6. HDOJ 1914 The Stable Marriage Problem

    rt 稳定婚姻匹配问题 The Stable Marriage Problem Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 6553 ...

  7. 【HDOJ】4729 An Easy Problem for Elfness

    其实是求树上的路径间的数据第K大的题目.果断主席树 + LCA.初始流量是这条路径上的最小值.若a<=b,显然直接为s->t建立pipe可以使流量最优:否则,对[0, 10**4]二分得到 ...

  8. hdoj 3861 The King’s Problem【强连通缩点建图&&最小路径覆盖】

    The King’s Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Other ...

  9. HDOJ(HDU) 2132 An easy problem

    Problem Description We once did a lot of recursional problem . I think some of them is easy for you ...

随机推荐

  1. Xcode常见错误以及解决方案

    一.Undefined symbols for architecture x86_64: Xcode升级到5.1 新特性之一就是默认让所有App都通过64位编译器编译.原来在Xcode5.0.x的时候 ...

  2. uitableviewcell 自适应大小 参考

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {     ...

  3. VS2010制作网站自定义安装程序 转

    最近在把一个网站打包成安装程序,这方面的文章网上有很多,也看了不少,但因为开发环境的不同,遇到了一些问题,便写下这篇文章记下整个流程(有很多资源都来自互联网,由于条目颇多,所以无法说明其来处,敬请谅解 ...

  4. shell脚本中>/dev/null的含义

    shell脚本中>/dev/null的含义 shell脚本中有段使用sqlplus的部分: sqlplus ${user_id} <<! >/dev/null spool sp ...

  5. ASP.NET Application_Error错误日志写入

    一个web项目开发已完成,测试也通过,但是,bug是测不完的,特别是在一个大的网络环境下.那么,我们就应该记录这些错误,然后改正.这里,我的出错管理页面是在global.asax里面的,利用里面的Ap ...

  6. ps 命令使用总结

    ps命令用来查看进程信息,它是类似于快照类型的只显示一次,如果想及时刷新请用top命令. 1. 常用参数列表 -a 显示所有终端机下执行的进程,除了阶段作业领导者之外. a 显示现行终端机下的所有进程 ...

  7. Codeforces Round #232 (Div. 1)

    这次运气比较好,做出两题.本来是冲着第3题可以cdq分治做的,却没想出来,明天再想好了. A. On Number of Decompositions into Multipliers 题意:n个数a ...

  8. 点点滴滴-ConfigurationManager.AppSettings

    在写程序的配置文件,里面添加了几个配置,下面是appSettings节点的设置 <appSettings> <add key="StyleFolder" valu ...

  9. 商务部公开微软持有的Android技术专利

    微软与众多Android厂商签署了专利授权协议,但从来没有公开它持有多少项Android技术专利.出人意料的是,为了收购诺基亚手机业务,微软今年4月递交到中国商务部的文件中完整公开了它的Android ...

  10. 函数 flst_get_first

    /********************************************************************//** Gets list first node addre ...