fork(1) download
  1.  
  2. //Author : Ujjawal Dixit , ABV-IIITM
  3. //Task : test
  4.  
  5. #include <bits/stdc++.h>
  6. #define MOD 1000000007
  7. #define MAX 1e9
  8. #define MIN -1e9
  9. using namespace std;
  10. typedef double ld;
  11. typedef long long ll;
  12. typedef vector<int> vi;
  13. typedef vector<vi> vvi;
  14. typedef pair<int,int> ii;
  15. #define FOR(i,n,m) for(int i=0;i<n;i+=m)
  16. #define For(i,n,m) for(int i=1;i<=n;i+=m)
  17. #define max(a,b) (a>=b?a:b)
  18. #define min(a,b) (a<b?a:b)
  19. #define countbits(num) __builtin_popcount(num)
  20. #define countbitsll(num) __builtin_popcountll(num)
  21. #define s(a) scanf("%d",&a)
  22. #define sll(a) scanf("%lld",&a)
  23. #define p(a) printf("%d",a)
  24. #define pll(a) printf("%lld",a)
  25. #define pln() printf("\n")
  26. #define getstr(in) getline(cin,in)
  27. #define getc() getchar()
  28. #define uj() int t; scanf("%d",&t); while(t--)
  29. template<typename T> T gcd(T a, T b) {
  30. if(!b) return a;
  31. return gcd(b, a % b);
  32. }
  33. template<typename T> T lcm(T a, T b) {
  34. return a * b / gcd(a, b);
  35. }
  36. int main()
  37. { int t ;
  38.  
  39. cin>>t ;
  40.  
  41. int o=0;
  42. int x,r,c ;
  43. while(t--)
  44. {
  45. cin>>x>>r>>c ;
  46.  
  47. if(x==1)
  48. { cout<<"Case #"<<o+1<<": "<<"GABRIEL"<<endl ;
  49. continue;
  50. }
  51.  
  52. if(x==2)
  53. { if((r*c)%2==0) { cout<<"Case #"<<o+1<<": "<<"GABRIEL"<<endl ; continue; }
  54. else {cout<<"Case #"<<o+1<<": "<<"RICHARD"<<endl ; continue;}
  55. }
  56.  
  57. if(x==3)
  58. { if( (r*c)%3==0 && c>=2 && r>=2 )
  59. cout<<"Case #"<<o+1<<": "<<"GABRIEL"<<endl ;
  60. else
  61. cout<<"Case #"<<o+1<<": "<<"RICHARD"<<endl ;
  62. continue;
  63. }
  64.  
  65. if(x==4)
  66. { if( (r==4 && c==4) || (r==4 && c==3 ) || (r==3 && c==4) )
  67. cout<<"Case #"<<o+1<<": "<<"GABRIEL"<<endl ;
  68. else cout<<"Case #"<<o+1<<": "<<"RICHARD"<<endl ;
  69. continue ;
  70. }
  71. }
  72.  
  73. return 0 ;
  74. }
Time limit exceeded #stdin #stdout 5s 3140KB
stdin
Standard input is empty
stdout
Standard output is empty