-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2309.py
More file actions
51 lines (50 loc) · 1.04 KB
/
2309.py
File metadata and controls
51 lines (50 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import sys
numbers = []
for i in range(9):
numbers.append(int(sys.stdin.readline().rstrip()))
sum = sum(numbers)
check = False
for i in range(8):
for j in range(i+1, 9):
if sum-numbers[i]-numbers[j] == 100:
numbers[i]=101
numbers[j]=101
check = True
break
if check:
break
numbers.sort()
for num in numbers[:7]:
print(num)
# #include<iostream>
# #include<algorithm>
# using namespace std;
#
# int main() {
# int heights[9];
# int heightSum = 0;
# for (int i = 0; i < 9; i++) {
# cin >> heights[i];
# heightSum += heights[i];
# }
# int x, y;
# for (int i = 0; i < 8; i++) {
# for (int j = i + 1; j < 9; j++) {
# if (heightSum - heights[i] - heights[j] == 100) {
# x = i; y = j;
# break;
# }
# }
# }
# int result[7];
# int count = 0;
# for (int i = 0; i < 9; i++) {
# if (i == x || i == y) continue;
# result[count++] = heights[i];
# }
# sort(&result[0], &result[7]);
# for (int i = 0; i < 7; i++) {
# cout << result[i] << '\n';
# }
# return 0;
# }