fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. ll n, t, b;
  5. int fact(long long x, long long t) {
  6. int cnt = 1 + x<=t;
  7. for (int i = 2; i * i <= x; ++i) {
  8. if (x % i == 0) {
  9. ++cnt;
  10. long long y = x / i;
  11. if (y <= t)
  12. ++cnt;
  13. }
  14. }
  15. return cnt % 2==0;
  16. }
  17. char ans[][4] = { "Off", "On" };
  18. int main(int argc, char **argv) {
  19. #ifndef ONLINE_JUDGE
  20. freopen("a.in", "r", stdin);
  21. #endif
  22. int cas = 1;
  23. while (scanf("%lld %lld %lld", &n, &t, &b) > 0) {
  24. t %= n;
  25. printf("Case %d: %s\n", cas++, ans[fact(b, t)]);
  26. }
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
Standard output is empty