hdoj 1898 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): 1490 Accepted Submission(s):
970
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.
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.
answer for one line. If Sempr won, output "Sempr!". If Xiangsanzi won, output
"Xiangsanzi!". And if both of them won, output "Both!".
- #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?的更多相关文章
- 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 ...
- 水题 HDOJ 4716 A Computer Graphics Problem
题目传送门 /* 水题:看见x是十的倍数就简单了 */ #include <cstdio> #include <iostream> #include <algorithm ...
- DFS+剪枝 HDOJ 5323 Solve this interesting problem
题目传送门 /* 题意:告诉一个区间[L,R],问根节点的n是多少 DFS+剪枝:父亲节点有四种情况:[l, r + len],[l, r + len - 1],[l - len, r],[l - l ...
- HDOJ(HDU).1016 Prime Ring Problem (DFS)
HDOJ(HDU).1016 Prime Ring Problem (DFS) [从零开始DFS(3)] 从零开始DFS HDOJ.1342 Lotto [从零开始DFS(0)] - DFS思想与框架 ...
- mutiset HDOJ 5349 MZL's simple problem
题目传送门 /* 这题可以用stl的mutiset容器方便求解,我对这东西不熟悉,TLE了几次,最后用读入外挂水过. 题解有O(n)的做法,还以为我是侥幸过的,后来才知道iterator it写在循环 ...
- HDOJ 1914 The Stable Marriage Problem
rt 稳定婚姻匹配问题 The Stable Marriage Problem Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 6553 ...
- 【HDOJ】4729 An Easy Problem for Elfness
其实是求树上的路径间的数据第K大的题目.果断主席树 + LCA.初始流量是这条路径上的最小值.若a<=b,显然直接为s->t建立pipe可以使流量最优:否则,对[0, 10**4]二分得到 ...
- hdoj 3861 The King’s Problem【强连通缩点建图&&最小路径覆盖】
The King’s Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- 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 ...
随机推荐
- C# - 参数数组Params
参数数组可以使用个数不定的参数调用函数,此时用params关键字定义它们. 限制:必须是函数定义中的最后一个参数:必须是同一类型的. 优点:不用在调用代码中传入数组,指定参数个数不受限制,可以不指定该 ...
- cocos2dx android平台事件系统解析
对于cocos2dx在android平台事件的响应过程很模糊,于是分析了下源码,cocos2dx 版本3.4,先导入一个android工程,然后看下AndroidManifest.xml <ap ...
- Seay工具分享
百度网盘:http://pan.baidu.com/share/home?uk=4045637737&view=share#category/type=0
- apache的 .htaccess文件的常用配置
使用.htaccess文件需要注意的地方: 1.找到配置文件httpd.conf,将override的值改成all.如下图:(如果不设置成all,apache将忽略.htaccess文件)
- glibc, eglibc和 glib的区别
http://blog.csdn.net/wind19/article/details/6082874
- 139. Word Break
题目: Given a string s and a dictionary of words dict, determine if s can be segmented into a space-se ...
- 解决“重新安装vmware-tools”灰色而无法安装的问题
前几天重装系统,之后虚拟机需要重新装,装好后要使用vmware-tools实现文件共享,却发现虚拟机那里显示为灰色的,无法安装vmware-tools,在共享文件夹那里设置好共享的文件夹猴也没有用,/ ...
- 【HDOJ】1196 Lowest Bit
水题,原理是计算机组成原理中的负数的补码的求码.利用按位与可解. #include <iostream> using namespace std; int main() { int n; ...
- POJ_2456_Agressive_cows_(二分,最大化最小值)
描述 http://poj.org/problem?id=2456 有n个小屋,线性排列在不同位置,m头牛,每头牛占据一个小屋,求最近的两头牛之间距离的最大值. Aggressive cows Tim ...
- Arch linux安装
安装archlinux可参考: http://blog.sina.com.cn/s/blog_69e5d8400101bqlj.html http://www.cnblogs.com/mad/p/32 ...