ZeroJudge D066: Go to School!

To determine if it's a time when students must be at school, check if the current time is between 7:30 and 17:00. If it falls within this range, then it's the time when students must be at school.

Sample Inputs/Outputs

Sample Input(s)Sample Output(s)
The input consists of a single line containing two integers separated by a space, hh and mm, where hh represents the current hour in the 24-hour format.If it is school time now, please output "At School"; otherwise, output "Off School."
17 00Off School

Thought Process

Use an If statement to determine if the input time falls within the school hours interval.

Sample Code-ZeroJudge D066: Go to School!

#include <iostream>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (a < 7 || a >= 17) cout << "Off School" << endl;
  else if (a == 7 && b < 30) cout << "Off School" << endl;
  else cout << "At School" << endl;
}

//Z.O.J. D066
//Dr. SeanXD

Comments