fork download
  1. #include <bits/stdc++.h>
  2. #define int long long
  3. #define fr(i, a, b) for (int i = a; i < b; i++)
  4. #define mmst(i,a) memset(i,a,sizeof(i))
  5. #define all(i) i.begin(),i.end()
  6. #define allr(i) i.rbegin(),i.rend()
  7. #define fast \
  8.   ios_base::sync_with_stdio(false); \
  9.   cin.tie(NULL); \
  10.   cout.tie(NULL);
  11. #define SS " "
  12. #define ddd cout<<"D"<<endl;
  13. #define dd(i) cout<<i<<endl;
  14. #define yes cout << "Yes" << endl
  15. #define no cout << "No" << endl
  16. const char nl = '\n';
  17. using namespace std;
  18.  
  19. const int mod = 1e9 + 7;
  20. const int sz = 1e6 + 5;
  21. const int inf = 1e18;
  22.  
  23. int q(int n){
  24. if(n == 0)return 3;
  25. else if(n == 1)return 1;
  26. else return 0;
  27. }
  28.  
  29. void solve()
  30. {
  31. int pa,pb,pc;cin>>pa>>pb>>pc;
  32. int arr[3] = {0, 1, 3};
  33. for(int i = 0; i <= 2; i++){
  34. for(int j = 0; j <= 2; j++){
  35. int tmpPa, tmpPb, tmpPc;
  36. for(int k = 0; k <= 2; k++){
  37. tmpPa = arr[i] + arr[j];
  38. tmpPb = q(i) + arr[k];
  39. tmpPc = q(j) + q(k);
  40. if(tmpPa == pa && tmpPb == pb && tmpPc == pc){
  41. cout<<"perfectus"<<nl;
  42. return;
  43. }
  44. }
  45. }
  46. }
  47. cout<<"invalidum"<<nl;
  48. }
  49.  
  50. int32_t main()
  51. {
  52. fast int T = 1;
  53. cin >> T;
  54. for (int tc = 1; tc <= T; tc++)
  55. {
  56. cout<<"Case "<<tc<<": ";
  57. solve();
  58. }
  59. return 0;
  60. }
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
Case 1: invalidum