码迷,mamicode.com
首页 > 其他好文 > 详细

杭电 HDU ACM 1898 Sempr == The Best Problem Solver?

时间:2015-04-09 17:30:54      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:c++   acm   杭电   算法   编程   

Sempr == The Best Problem Solver?

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


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!
 

Author
Sempr|CrazyBird|hust07p43
 
就因为 把Sempr 错打成Semper 还仔细检查 都没看出来!类似的好几次了、
#include<iostream>
using namespace std;
int main()
{
	int n,a,b,t,num1,num2;
	cin>>n;
	while(n--)
	{
		cin>>a>>b>>t;
		if(t%a<t%b)
			cout<<"Sempr!"<<endl;
		else if(t%a>t%b)
			cout<<"Xiangsanzi!"<<endl;
		else
			cout<<"Both!"<<endl;
	}
	return 0;
}
		

杭电 HDU ACM 1898 Sempr == The Best Problem Solver?

标签:c++   acm   杭电   算法   编程   

原文地址:http://blog.csdn.net/lsgqjh/article/details/44961641

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!