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. UGUI-组件

    2015-06-22 UGUI 组件 Canvas 画布 The Canvas component represents the abstract space in which the UI is l ...

  2. [CC150] 八皇后问题

    Write an algorithm to print all ways of arranging eight queens on an 8*8 chess board so that none of ...

  3. BT5之网络配置

    输入ifconfig命令,可以查看当前IP地址设置情况.查看路由表的命令(用来检查默认网关是否设置正确):netstat -r 一.让BT5自动获取IP地址 自动获取IP地址,使用dhclient命令 ...

  4. NSBundle的使用,注意mainBundle和Custom Bundle的区别

    1.[NSBundle mainBundle],文件夹其实是Group,如左侧的树形文件管理器 Build之后,文件直接就复制到了根目录下,于是读取的方法,应该是这样: NSString *earth ...

  5. HDU 2986 Ballot evaluation(精度问题)

    点我看题目 题意 : 给你n个人名,每个名后边跟着一个数,然后m个式子,判断是否正确. 思路 :算是一个模拟吧,但是要注意浮点数容易丢失精度,所以要好好处理精度,不知道多少人死在精度上,不过我实在是不 ...

  6. PHP dirname() 函数

    定义和用法 dirname() 函数返回路径中的目录部分. 语法 dirname(path) 参数 描述 path 必需.规定要检查的路径. 说明 path 参数是一个包含有指向一个文件的全路径的字符 ...

  7. SQL Server 行列转换

    /* 标题:普通行列转换(version 2.0) 作者:范中磊 说明:普通行列转换(version 1.0)仅针对sql server 2000提供静态和动态写法,version 2.0增加sql ...

  8. NHibernate与EF(Entity Framework)的区别

    http://www.cnblogs.com/lukun/archive/2011/05/16/2047587.html NHibernate与EF(Entity Framework)的区别 http ...

  9. UDP模块(黑胶体)

    UDP模块是采用PIP封装技术的U盘半成品模块,直接加上外壳,就是成品U盘. 它有以下特点: 防水.防尘.防震. 一体WAFER封装技术. 薄.轻.时尚. 产品装配方便.简单. 产品标准化,适合客户在 ...

  10. Android 如何在Java代码中手动设置控件的marginleft

    1.定义LayoutParams LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.La ...