fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int oneInFour=0;
  8. int twoInOne=0;
  9. int twoInTwo=0;
  10. int threeInOne=0;
  11. int fourInOne=0;
  12. int[] counts = new int[5];
  13. for(int a=1;a<=4;a++) {
  14. counts[a]++;
  15. for(int b=1;b<=4;b++) {
  16. counts[b]++;
  17. for(int c=1;c<=4;c++) {
  18. counts[c]++;
  19. for(int d=1;d<=4;d++) {
  20. counts[d]++;
  21.  
  22. int ones=0;
  23. int twos=0;
  24. for(int i=1;i<=4;i++) {
  25. if(counts[i]==4) {
  26. fourInOne++;
  27. break;
  28. } else if(counts[i]==3) {
  29. threeInOne++;
  30. break;
  31. } else if(counts[i]==2) {
  32. twos++;
  33. } else if(counts[i]==1) {
  34. ones++;
  35. }
  36. }
  37. if(twos==2)
  38. twoInTwo++;
  39. else if(twos==1)
  40. twoInOne++;
  41. else if(ones==4)
  42. oneInFour++;
  43.  
  44. counts[d]--;
  45. }
  46. counts[c]--;
  47. }
  48. counts[b]--;
  49. }
  50. counts[a]--;
  51. }
  52. Console.WriteLine("oneInFour="+oneInFour);
  53. Console.WriteLine("twoInOne="+twoInOne);
  54. Console.WriteLine("twoInTwo="+twoInTwo);
  55. Console.WriteLine("threeInOne="+threeInOne);
  56. Console.WriteLine("fourInOne="+fourInOne);
  57. }
  58. }
Success #stdin #stdout 0.01s 131648KB
stdin
Standard input is empty
stdout
oneInFour=24
twoInOne=144
twoInTwo=36
threeInOne=48
fourInOne=4