程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> HDU1898:Sempr == The Best Problem Solver?

HDU1898:Sempr == The Best Problem Solver?

編輯:C++入門知識

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!

五一假瘋狂玩了三天,也是時候該認真做題了啊

不管那麼多,先來道水題再說

題目長,但是其實是水題

 

[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 << "Sempr!"; 
        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 << "Sempr!";
        cout << endl;
    }

    return 0;
}


 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved