Hdoj 1898 Sempr = = The best problem Solver?

Source: Internet
Author: User

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 Descriptionas is known to all, Sempr (liangjing Wang) had solved more than 1400 problems on POJ, but nobody know th E days and nights he had spent on solving problems.
Xiangsanzi (Chen Zhou) was a perfect problem solver too. Now the is a stories about them happened and years ago.
On March 2006, SEMPR & Xiangsanzi were new comers of HUSTACM team and both of them want to being "the best new comers of March ", so they spent days and nights solving problems on POJ.
Now the problem is below:both of them be perfect problem solvers and they had the same speed, that's to say SEMPR can S Olve 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 solve D at Time T. Give you three integers a,b,and T, you should tell me who's "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.

Inputin the first line there are an integer N, which means the number of cases in the data file, followed by N lines.
For each line, there is 3 integers:a, B, T.
Be sure, that a, B and N are no more than 10000 and T is no more than 100000000.

Outputfor 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 Input32 3 42 3 62 3 9

Sample outputsempr! both! xiangsanzi!

  

Hdoj 1898 Sempr = = The best problem Solver?

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.