R

@RealSaitama

V.A paramètres

Python
4 days ago
n = int(input()) xs, fs = [], [] for _ in range(n): x, f = map(float, input().split(' ')) xs.append(x) fs.append(f) print(xs, fs) mean = lambda xs, fs: sum(x * f for x, f in zip(xs, fs)) variance = lambda xs, fs: sum(x**2 * f for x, f in zip(xs, fs)) - mean(xs, fs)**2

Bezout

Python
1 week ago
def bezout_ext(a, b): qs, rs = [], [a, b] while b > 0: q, r = divmod(a, b) print(f"{a} = {b} * {q} + {r}") qs.append(q) rs.append(r) a, b = b, a % b n = len(qs) - 3 m = len(rs) - 3

Generate decrease products

Python
1 week ago
# import heapq as hq # def solve(a, b): # seen = set([(b, b)]) # q = [(-b * b, b, b)] # hq.heapify(q) # while q: # p, x, y = hq.heappop(q) # s = str(-p)

Palindromic Product

Python
1 week ago
def previous_greatest_palindrome(n): ns = str(n) k = len(ns) if ns == f"1{'0' * (k - 2)}1": return int("9" * (k - 1)) if k % 2 == 0: m = int(''.join(map(str, ns[0 : k // 2]))) u = f"1{'0' * (k // 2 - 1)}" if m == int(u) and (r := int(u + u[::-1])) < n: return r

Latex Equation

NodeJS
2 weeks ago
class fraction { n; d; s; constructor(n, d) { const g = this.gcd(Math.abs(n), Math.abs(d)); this.n = Math.abs(n / g); this.d = Math.abs(d / g); this.s = n * d < 0 ? -1 : 1;

Ex58

Python
3 weeks ago
def solve(a, b, c, window): xmin, xmax, ymin, ymax = window L = [] for x in range(xmin, xmax + 1): for y in range(ymin, ymax + 1): if a * x + b * y + c == 0: L.append((x, y)) return L s = 10

Gain Moyen

Python
3 weeks ago
from random import randint def esperance_jeu(nb_sim, mise): gain_total = 0 for _ in range(nb_sim): gain = -mise x = randint(1, 6) gain += 2 * x y = randint(1, 5) gain += 1 if y <= 4 else 7

Last non zero digit of factorial(n) in base b

Python
1 month ago
from collections import Counter from math import gcd, prod def factor(m): n = m f = [] for d in [2, 3, 5]: while n % d == 0: f.append(d) n //= d

Last non zero digit of factorial(n)

Python
1 month ago
d=[1,1,2,6,4,2,2,4,2,8] def last_digit(n): if n<10: return d[n] m=n//10 if m%2==0: return (6*last_digit(n//5)*last_digit(n%10))%10 else: return (4*last_digit(n//5)*last_digit(n%10))%10

Random Clock

Python
1 month ago
arr, time = [8, 1, 7, 2, 6, 3, 5, 4, 12, 11, 10, 9], "05:30:00" def clock_angle(arr, time): a = [x % 12 for x in arr] print(a) h, m, s = map(int, time.split(":")) H = h + m / 60 + s / 3600 x, fx = int(H), H % 1

Loi de probabilité

Python
1 month ago
from math import prod, comb from fractions import Fraction a, n = 3, 10 def loi(a, n): return [Fraction(comb(n- k, n - a - 1), comb(n,a)) for k in range(1, a + 2)] l = loi(3, 10)

EXPERTES

Python
1 month ago
msg = "MONCOURSPREFERE" def to_int(c): return ord(c) - ord('A') def to_chr(x): return chr(ord('A') + x) def cipher(st): res = "" for c in st:

Welsh Powell

Python
1 month ago
graph = { 'A': set("HB"), 'B': set("AD"), 'C': set("D"), 'D': set("BCIK"), 'E': set("FK"), 'F': set("EG"), 'G': set("FHK"), 'H': set("AIJKG"), 'I': set("HJD"),

Integer Derivative

Python
1 month ago
from collections import Counter from math import gcd def factor(m): n = m f = [] for d in [2, 3, 5]: while n % d == 0: f.append(d) n //= d

Rallye Première 2026

Python
1 month ago
def solve(n): r = 0 uniq = set() for x in range(1,n+1): for y in range(1,n+1): for z in range(1,n+1): if abs(x-y)<z < x+ y and x+y+z== n and x != y and y != z and x!=z: e = tuple(sorted((x, y, z))) if not e in uniq:

Tex to Custom tag

Python
2 months ago
s=r'''\section{A. Généralités} \begin{frame} \begin{center} \Large{A. Généralités} \end{center} \end{frame} \begin{frame}{A.1 Définition} \pause Dans tout ce qui suit, le plan est muni d'un repère \textit{\textbf{orthonormé}}.\pause\\

Rallye 2026

Python
2 months ago
# exercice 1 from itertools import product, combinations k = 5 cnt = 0 for c in product(range(1, 7), repeat=k): if all(c[i] != c[(i + 2) % k] and c[i] != c[(i + 3) % k] for i in range(k)): cnt += 1 print(cnt)

Text to HTML (reveal.js) converter

Python
2 months ago
import re slide = r''' <s> <cha>Variables aléatoires</cha> <os> <o>Généralités</o> <o>Loi de probabilité</o> <o>Tendance centrale et dispersion</o> <o>Linéarité de l'espérance</o>

Gauss Modulo

Python
2 months ago
a = [[0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0

Text to HTML (reveal.js) converter

Python
2 months ago
import re # slide = "" # while 1: # try: # slide += input() # except: # break slide = r''' <s>