编程介的小学生 2017-05-27 16:49 采纳率: 20.5%
浏览 816
已采纳

Sempr == The Best Problem Solver?

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!

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-06-17 15:50
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站