2016年1月14日 星期四

d066: 上學去吧!

內容 :
板橋高中規定同學必須在 7:30 以前到校早自習,最後一堂課則在 17:00 下課。給你現在的時間,請判斷現在是不是必須在學校的時間。
輸入說明 : 
輸入只有一行,其中含有兩個由空隔開的整數 hh 及 mm,hh:mm 則代表現在的時間 (24小時制)。
輸出說明 : 
如果現在是上學時間,請輸出「At School」,否則請輸出「Off School」
範例輸入 : help
17 00
範例輸出:
Off School
提示 : 
出處: 


import java.util.Scanner;

public class d066 {

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
int m=sc.nextInt();
if(n==7&&m==30||n>=8&&n<=16){
System.out.println("At School");
}
else{
System.out.println("Off School");
}
}


}

}

沒有留言:

張貼留言