Problem Description

板橋高中規定同學必須在 7:30 以前到校早自習,最後一堂課則在 17:00 下課。給你現在的時間,請判斷現在是上學時間或放學時間。 

The Input

輸入只有一行,其中含有兩個由空隔開的整數 hh 及 mm,hh:mm 則代表現在的時間 (24小時制)。

The Output

如果現在是上學時間,請輸出「At School」,否則請輸出「Off School」

Sample Input

17     00

Sample Output

Off School

-----* Problem from【ZeroJudge, an Online Judge System For Beginners

My Answer

 
1
2
3
4
5
6
7
8
9
10
11
12
  #include<iostream>
using namespace std;
int main(void)
{
  int h, m;
  while(cin>>h>>m){
    if((h==7 && m>=30) ||(h>7 && h<17))
      cout<<"At School"<<endl;
    else cout<<"Off School"<<endl;
  }
  return 0;
}
 

 


arrow
arrow
    全站熱搜

    兔老大 發表在 痞客邦 留言(0) 人氣()