Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
def compare(n,t):
	s=0
	p=0
	for i in range(len(t)):
		s=s+t[i]
		p=p+(n-t[i])
	if p>s:
		return(True)
	else:
		return(False)
def func(n,t):
	if compare(n,t)==True and n==max(t):
		return(n)
	if compare(n,t)==True and n>max(t):
		a=[n]
		while n!=max(t):
			n=n-1
			if compare(n,t)==True:
				a.append(n)
		return(min(a))
	if compare(n,t)==False:
		while compare(n,t)!=True:
			n=n+1
		return(n)
a=int(input())
b=list(map(int,input().split())
print(func(a,b))
J'ai une erreur de syntaxe pour le print(func(a,b)) . Or j'ai bien mis toutes les parenthèses! Merci d'avance.