fork download
  1. #include <iostream>
  2. using namespace std;
  3. static constexpr bool isFemale = false;
  4. static constexpr int Hong = 10;
  5. static constexpr int Lee = 7;
  6. static constexpr bool onlyContinuous = false;
  7.  
  8. int g[89]={0,
  9. 1,0,1,0,1, 1,1,1,0,0,
  10. 1,0,1,0,1, 1,1,1,0,0,
  11. 1,0,1,1,1, 0,0,0,1,0,
  12. 1,1,1,0,1, 0,1,1,0,1,
  13. 1,0,0,0,1, 0,1,1,0,0,
  14. 0,1,0,0,0, 0,1,0,0,0,
  15. 1,0,1,0,1, 0,1,1,0,0,
  16. 0,0,1,0,1, 0,0,0,0,0,
  17. 0,
  18. };
  19. int getp(int x){
  20. return ((x+9)%10)/2;
  21. }
  22. int mdif(int p,int q){
  23. p-=q;
  24. p=(p+100)%5;
  25. if(p>=3)p=5-p;
  26. return p;
  27. }
  28. bool valid(int p,int q,int r){
  29. if constexpr(onlyContinuous) return mdif(p,q)==1 && mdif(q,r)==1;
  30. return mdif(p,q)<=1 && mdif(q,r)<=1;
  31. }
  32. int main() {
  33. if(isFemale){
  34. g[21]=g[23]=g[33]=g[39]=0;
  35. }
  36. int x=Lee;
  37. for(int y=1;y<=30;y++){
  38. for(int z=1;z<=30&&x+y+z<=81;z++){
  39. int p=y+z;
  40. int q=x+y;
  41. int r=x+z;
  42. int s=x+y+z;
  43. if(g[p]&&g[q]&&g[r]&&g[s])
  44. {
  45. int pp=getp(p);
  46. int qq=getp(q);
  47. int rr=getp(r);
  48. if(valid(pp,qq,rr)){
  49. printf("%d %d\n",y,z);
  50. }
  51. }
  52. }
  53. }
  54. return 0;
  55. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
6 18
6 25
8 8
8 9
8 10
8 16
8 17
8 30
9 8
9 9
9 16
10 8
10 28
10 30
14 17
14 26
16 8
16 9
16 17
16 25
17 8
17 14
17 16
17 24
17 28
18 6
24 16
24 17
25 6
25 16
28 10
28 17
30 8
30 10