diff --git a/04-03-24/a.py b/04-03-24/a.py new file mode 100644 index 0000000..9db8b8c --- /dev/null +++ b/04-03-24/a.py @@ -0,0 +1,27 @@ +import math + +def are_coprime(a, b): + return math.gcd(a, b) == 1 + +def find_greatest(): + input() + alist = [int(a) for a in input().split()] + + mapping = {} + for i in range(len(alist)): + mapping[alist[i]] = i + + maxi = -1 + for a in mapping: + for b in mapping: + if mapping[a]+mapping[b]+2 > maxi and are_coprime(a, b): + maxi = mapping[a]+mapping[b]+2 + + return maxi + +def main(): + nb = int(input()) + for i in range(nb): + print(find_greatest()) + +main() \ No newline at end of file diff --git a/04-03-24/b.py b/04-03-24/b.py new file mode 100644 index 0000000..e4a5cd1 --- /dev/null +++ b/04-03-24/b.py @@ -0,0 +1,18 @@ +def pair(n): + if n%2 == 0: + return "No" + + l = (3/2)*(n+1) + + res = [] + for i in range(1, (n+1)//2): + res.append((i, l+i-1)) + + for i in range(1, (n+1)//2+n%2): + res.append((n-i+1, l-i)) + + return "Yes\n"+"\n".join([f"{int(a[0])} {int(a[1])}" for a in res]) + + +for _ in range(int(input())): + print(pair(int(input()))) diff --git a/04-03-24/c.py b/04-03-24/c.py new file mode 100644 index 0000000..86fbb80 --- /dev/null +++ b/04-03-24/c.py @@ -0,0 +1,30 @@ +import math + +def get_primes(n): + divs = [] + for i in range(1, int(math.sqrt(n)+1)): + if n%i == 0: + divs.append((i, n//i)) + divs.append((n//i, i)) + + return divs + +def main(): + [a, b, c, d] = [int(a) for a in input().split()] + + if c*d < 2*a*b: + return "-1 -1" + + primes = get_primes(a*b) + + for i, j in primes: + for alpha in range(1, c//i+1): + for beta in range(1, d//j+1): + #print(i*alpha, j*beta) + if (i*alpha > a and j*beta > b) and (i*alpha <= c and j*beta <= d): + return f"{i*alpha} {j*beta}" + + return "-1 -1" + +for _ in range(int(input())): + print(main()) \ No newline at end of file diff --git a/04-03-24/sujet.pdf b/04-03-24/sujet.pdf new file mode 100644 index 0000000..6b25790 Binary files /dev/null and b/04-03-24/sujet.pdf differ