fork download
  1. import itertools as it
  2. import numpy
  3.  
  4. count = 0
  5. valid = 0
  6. for points in it.combinations(it.product(range(4), repeat=2), 3):
  7. count = count + 1
  8. for a, b, c in it.permutations(points):
  9. ab = numpy.subtract(b, a)
  10. ac = numpy.subtract(c, a)
  11. if numpy.dot(ab, ac) == 0:
  12. valid = valid + 1
  13. print("%3d: %s" % (valid, points))
  14. break;
  15. print("\np=%d/%d" % (valid, count))
  16.  
Success #stdin #stdout 0.13s 92224KB
stdin
Standard input is empty
stdout
  1: ((0, 0), (0, 1), (1, 0))
  2: ((0, 0), (0, 1), (1, 1))
  3: ((0, 0), (0, 1), (2, 0))
  4: ((0, 0), (0, 1), (2, 1))
  5: ((0, 0), (0, 1), (3, 0))
  6: ((0, 0), (0, 1), (3, 1))
  7: ((0, 0), (0, 2), (1, 0))
  8: ((0, 0), (0, 2), (1, 1))
  9: ((0, 0), (0, 2), (1, 2))
 10: ((0, 0), (0, 2), (2, 0))
 11: ((0, 0), (0, 2), (2, 2))
 12: ((0, 0), (0, 2), (3, 0))
 13: ((0, 0), (0, 2), (3, 2))
 14: ((0, 0), (0, 3), (1, 0))
 15: ((0, 0), (0, 3), (1, 3))
 16: ((0, 0), (0, 3), (2, 0))
 17: ((0, 0), (0, 3), (2, 3))
 18: ((0, 0), (0, 3), (3, 0))
 19: ((0, 0), (0, 3), (3, 3))
 20: ((0, 0), (1, 0), (1, 1))
 21: ((0, 0), (1, 0), (1, 2))
 22: ((0, 0), (1, 0), (1, 3))
 23: ((0, 0), (1, 1), (2, 0))
 24: ((0, 0), (1, 2), (3, 1))
 25: ((0, 0), (1, 3), (2, 1))
 26: ((0, 0), (1, 3), (2, 2))
 27: ((0, 0), (2, 0), (2, 1))
 28: ((0, 0), (2, 0), (2, 2))
 29: ((0, 0), (2, 0), (2, 3))
 30: ((0, 0), (2, 2), (3, 1))
 31: ((0, 0), (3, 0), (3, 1))
 32: ((0, 0), (3, 0), (3, 2))
 33: ((0, 0), (3, 0), (3, 3))
 34: ((0, 1), (0, 2), (1, 1))
 35: ((0, 1), (0, 2), (1, 2))
 36: ((0, 1), (0, 2), (2, 1))
 37: ((0, 1), (0, 2), (2, 2))
 38: ((0, 1), (0, 2), (3, 1))
 39: ((0, 1), (0, 2), (3, 2))
 40: ((0, 1), (0, 3), (1, 1))
 41: ((0, 1), (0, 3), (1, 2))
 42: ((0, 1), (0, 3), (1, 3))
 43: ((0, 1), (0, 3), (2, 1))
 44: ((0, 1), (0, 3), (2, 3))
 45: ((0, 1), (0, 3), (3, 1))
 46: ((0, 1), (0, 3), (3, 3))
 47: ((0, 1), (1, 0), (1, 1))
 48: ((0, 1), (1, 0), (1, 2))
 49: ((0, 1), (1, 0), (2, 1))
 50: ((0, 1), (1, 0), (2, 3))
 51: ((0, 1), (1, 0), (3, 2))
 52: ((0, 1), (1, 1), (1, 2))
 53: ((0, 1), (1, 1), (1, 3))
 54: ((0, 1), (1, 2), (2, 1))
 55: ((0, 1), (1, 2), (3, 0))
 56: ((0, 1), (1, 3), (2, 0))
 57: ((0, 1), (1, 3), (3, 2))
 58: ((0, 1), (2, 0), (2, 1))
 59: ((0, 1), (2, 0), (3, 2))
 60: ((0, 1), (2, 1), (2, 2))
 61: ((0, 1), (2, 1), (2, 3))
 62: ((0, 1), (2, 2), (3, 0))
 63: ((0, 1), (2, 3), (3, 2))
 64: ((0, 1), (3, 0), (3, 1))
 65: ((0, 1), (3, 1), (3, 2))
 66: ((0, 1), (3, 1), (3, 3))
 67: ((0, 2), (0, 3), (1, 2))
 68: ((0, 2), (0, 3), (1, 3))
 69: ((0, 2), (0, 3), (2, 2))
 70: ((0, 2), (0, 3), (2, 3))
 71: ((0, 2), (0, 3), (3, 2))
 72: ((0, 2), (0, 3), (3, 3))
 73: ((0, 2), (1, 0), (1, 2))
 74: ((0, 2), (1, 0), (2, 3))
 75: ((0, 2), (1, 0), (3, 1))
 76: ((0, 2), (1, 1), (1, 2))
 77: ((0, 2), (1, 1), (1, 3))
 78: ((0, 2), (1, 1), (2, 2))
 79: ((0, 2), (1, 1), (3, 3))
 80: ((0, 2), (1, 2), (1, 3))
 81: ((0, 2), (1, 3), (2, 0))
 82: ((0, 2), (1, 3), (2, 2))
 83: ((0, 2), (1, 3), (3, 1))
 84: ((0, 2), (2, 0), (2, 2))
 85: ((0, 2), (2, 0), (3, 1))
 86: ((0, 2), (2, 1), (2, 2))
 87: ((0, 2), (2, 1), (3, 3))
 88: ((0, 2), (2, 2), (2, 3))
 89: ((0, 2), (2, 3), (3, 1))
 90: ((0, 2), (3, 0), (3, 2))
 91: ((0, 2), (3, 1), (3, 2))
 92: ((0, 2), (3, 2), (3, 3))
 93: ((0, 3), (1, 0), (1, 3))
 94: ((0, 3), (1, 0), (2, 1))
 95: ((0, 3), (1, 0), (2, 2))
 96: ((0, 3), (1, 1), (1, 3))
 97: ((0, 3), (1, 1), (3, 2))
 98: ((0, 3), (1, 2), (1, 3))
 99: ((0, 3), (1, 2), (2, 3))
100: ((0, 3), (2, 0), (2, 3))
101: ((0, 3), (2, 1), (2, 3))
102: ((0, 3), (2, 1), (3, 2))
103: ((0, 3), (2, 2), (2, 3))
104: ((0, 3), (3, 0), (3, 3))
105: ((0, 3), (3, 1), (3, 3))
106: ((0, 3), (3, 2), (3, 3))
107: ((1, 0), (1, 1), (2, 0))
108: ((1, 0), (1, 1), (2, 1))
109: ((1, 0), (1, 1), (3, 0))
110: ((1, 0), (1, 1), (3, 1))
111: ((1, 0), (1, 2), (2, 0))
112: ((1, 0), (1, 2), (2, 1))
113: ((1, 0), (1, 2), (2, 2))
114: ((1, 0), (1, 2), (3, 0))
115: ((1, 0), (1, 2), (3, 2))
116: ((1, 0), (1, 3), (2, 0))
117: ((1, 0), (1, 3), (2, 3))
118: ((1, 0), (1, 3), (3, 0))
119: ((1, 0), (1, 3), (3, 3))
120: ((1, 0), (2, 0), (2, 1))
121: ((1, 0), (2, 0), (2, 2))
122: ((1, 0), (2, 0), (2, 3))
123: ((1, 0), (2, 1), (3, 0))
124: ((1, 0), (2, 3), (3, 1))
125: ((1, 0), (2, 3), (3, 2))
126: ((1, 0), (3, 0), (3, 1))
127: ((1, 0), (3, 0), (3, 2))
128: ((1, 0), (3, 0), (3, 3))
129: ((1, 1), (1, 2), (2, 1))
130: ((1, 1), (1, 2), (2, 2))
131: ((1, 1), (1, 2), (3, 1))
132: ((1, 1), (1, 2), (3, 2))
133: ((1, 1), (1, 3), (2, 1))
134: ((1, 1), (1, 3), (2, 2))
135: ((1, 1), (1, 3), (2, 3))
136: ((1, 1), (1, 3), (3, 1))
137: ((1, 1), (1, 3), (3, 3))
138: ((1, 1), (2, 0), (2, 1))
139: ((1, 1), (2, 0), (2, 2))
140: ((1, 1), (2, 0), (3, 1))
141: ((1, 1), (2, 0), (3, 3))
142: ((1, 1), (2, 1), (2, 2))
143: ((1, 1), (2, 1), (2, 3))
144: ((1, 1), (2, 2), (3, 1))
145: ((1, 1), (2, 3), (3, 0))
146: ((1, 1), (3, 0), (3, 1))
147: ((1, 1), (3, 1), (3, 2))
148: ((1, 1), (3, 1), (3, 3))
149: ((1, 2), (1, 3), (2, 2))
150: ((1, 2), (1, 3), (2, 3))
151: ((1, 2), (1, 3), (3, 2))
152: ((1, 2), (1, 3), (3, 3))
153: ((1, 2), (2, 0), (2, 2))
154: ((1, 2), (2, 0), (3, 3))
155: ((1, 2), (2, 1), (2, 2))
156: ((1, 2), (2, 1), (2, 3))
157: ((1, 2), (2, 1), (3, 2))
158: ((1, 2), (2, 2), (2, 3))
159: ((1, 2), (2, 3), (3, 0))
160: ((1, 2), (2, 3), (3, 2))
161: ((1, 2), (3, 0), (3, 2))
162: ((1, 2), (3, 1), (3, 2))
163: ((1, 2), (3, 2), (3, 3))
164: ((1, 3), (2, 0), (2, 3))
165: ((1, 3), (2, 0), (3, 1))
166: ((1, 3), (2, 0), (3, 2))
167: ((1, 3), (2, 1), (2, 3))
168: ((1, 3), (2, 2), (2, 3))
169: ((1, 3), (2, 2), (3, 3))
170: ((1, 3), (3, 0), (3, 3))
171: ((1, 3), (3, 1), (3, 3))
172: ((1, 3), (3, 2), (3, 3))
173: ((2, 0), (2, 1), (3, 0))
174: ((2, 0), (2, 1), (3, 1))
175: ((2, 0), (2, 2), (3, 0))
176: ((2, 0), (2, 2), (3, 1))
177: ((2, 0), (2, 2), (3, 2))
178: ((2, 0), (2, 3), (3, 0))
179: ((2, 0), (2, 3), (3, 3))
180: ((2, 0), (3, 0), (3, 1))
181: ((2, 0), (3, 0), (3, 2))
182: ((2, 0), (3, 0), (3, 3))
183: ((2, 1), (2, 2), (3, 1))
184: ((2, 1), (2, 2), (3, 2))
185: ((2, 1), (2, 3), (3, 1))
186: ((2, 1), (2, 3), (3, 2))
187: ((2, 1), (2, 3), (3, 3))
188: ((2, 1), (3, 0), (3, 1))
189: ((2, 1), (3, 0), (3, 2))
190: ((2, 1), (3, 1), (3, 2))
191: ((2, 1), (3, 1), (3, 3))
192: ((2, 2), (2, 3), (3, 2))
193: ((2, 2), (2, 3), (3, 3))
194: ((2, 2), (3, 0), (3, 2))
195: ((2, 2), (3, 1), (3, 2))
196: ((2, 2), (3, 1), (3, 3))
197: ((2, 2), (3, 2), (3, 3))
198: ((2, 3), (3, 0), (3, 3))
199: ((2, 3), (3, 1), (3, 3))
200: ((2, 3), (3, 2), (3, 3))

p=200/560