NCPC26 ending

This commit is contained in:
Joel committed 2026-10-03 16:16:18 +02:00
1 parent fbd41d8ac7
commit 2820c84507
34 files changed
+612 -311

No files matched your search

-23
View File
@@ -1,23 +0,0 @@
import sys
l = 0
r = 1001
m = 500
temp = m
for i in range(10):
print(m)
sys.stdout.flush()
term = input()
if term == "correct":
exit()
elif term == "lower":
temp = m
m = (l + m) // 2
r = temp
else:
temp = m
m = (m + r) // 2
l = temp
-12
View File
@@ -1,12 +0,0 @@
ball = 1
for i in range(5):
j = int(input())
k = int(input())
if j == ball:
ball = k
elif k == ball:
ball = j
print(ball)
-4
View File
@@ -1,4 +0,0 @@
w = int(input())
l = int(input())
print(w*l)
+38
View File
@@ -0,0 +1,38 @@
import sys
for line in sys.stdin:
pices = int(line)
if (pices == 0):
print(0)
exit()
arr = list()
arr = map(int, input().split())
ar = sorted(arr)
half = ar[pices-1] / 2
i = 0
index = 0
closest = 1001
if (pices == 1):
print(ar[0])
exit()
while ar[i] <= half:
i += 1
if i > 0:
if (ar[i] - half) <= closest:
closest = (ar[i] - half)
index = i
if (half - ar[i-1]) <= closest:
closest = (ar[i-1] - half)
index = i-1
else:
index = 0
print(max((ar[pices-1] - ar[index]), ar[index]))
+26
View File
@@ -0,0 +1,26 @@
3
400 199 201
3
400 202 199
3
400 201 198
2
500 100
2
101 99
3
100 100 100
3
100 200 300
3
1000 1 1
3
1000 500 100
3
100 101 99
3
100 150 50
4
200 400 200 100
7
100 100 900 500 500 1000 400
+22
View File
@@ -0,0 +1,22 @@
3
401 600 1000
3
1 600 1000
2
1 2
2
1 1
3
1 1 2
4
1 2 1 1
4
1 2 2 1
4
1 2 2 2
4
400 1000 1000 1000
5
1000 1000 1000 998 22
4
300 500 150 100
View File
Whitespace-only changes.