HDU1898: sepr = The Best Problem Solver?

Source: Internet
Author: User

Problem Description
As is known to all, sepr (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, sepr & 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 nighthts 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 sespa can solve the same amount of problems as Xiangsanzi, but semip 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 wocould check The number of problems they solved at time T. give you three integers A, B, and T, you shoshould tell me who is "The Best New Comers of March ". if they solved the same amount of problems, output "Both! ". If semip or Xiangsanzi submitted at time T, static wowould 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 seflat won, output "seflat! ". 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
Seflat!
Both!
Xiangsanzi!

I have been playing crazy for three days on May Day, so it's time to do it seriously.

If there are so many questions, let's talk about them first.

Long question, but actually water question

 

[Cpp] # include <iostream>
Using namespace std;
 
Int main ()
{
Int a, B, t, test;
Cin> test;
While (test --)
{
Cin> a> B> t;
Int ta = t % a, tb = t % B;
If (ta = tb)
Cout <"Both! ";
Else if (ta> tb)
Cout <"Xiangsanzi! ";
Else
Cout <"seflat! ";
Cout <endl;
}
 
Return 0;
}

# Include <iostream>
Using namespace std;

Int main ()
{
Int a, B, t, test;
Cin> test;
While (test --)
{
Cin> a> B> t;
Int ta = t % a, tb = t % B;
If (ta = tb)
Cout <"Both! ";
Else if (ta> tb)
Cout <"Xiangsanzi! ";
Else
Cout <"seflat! ";
Cout <endl;
}

Return 0;
}


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.