from qsim.etape3_plusieurs_qubits import H, apply_cnot, apply_single, sample, zero_state

# Exercice 1 : l'état GHZ de trois qubits
state = apply_single(zero_state(3), H, 0)
state = apply_cnot(state, 0, 1)
state = apply_cnot(state, 1, 2)
print("amplitudes non nulles :", {f"{i:03b}": round(float(a), 3) for i, a in enumerate(state) if abs(a) > 1e-9})
print("1 000 shots :", sample(state, 1000, seed=42))
