mirror of
https://github.com/Fare-spec/cours.git
synced 2025-12-07 10:50:36 +00:00
Auto urgent commit.
This commit is contained in:
1412
get_bac_subject/get_bac_subject/Cargo.lock
generated
Normal file
1412
get_bac_subject/get_bac_subject/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
8
get_bac_subject/get_bac_subject/Cargo.toml
Normal file
8
get_bac_subject/get_bac_subject/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "get_bac_subject"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
reqwest = { version = "0.11", features = ["blocking"] }
|
||||
19
get_bac_subject/get_bac_subject/src/main.rs
Normal file
19
get_bac_subject/get_bac_subject/src/main.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
fn download_file(url: &str, output_path: &str) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let response = get(url)?;
|
||||
if !response.status().is_success()
|
||||
let mut dest = File::create(Path::new(output_path))?;
|
||||
let mut content = response;
|
||||
copy(&mut content, &mut dest)?;
|
||||
println!("📥 Downloaded: {} → {}", url, output_path);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let url = "https://drive.proton.me/urls/XZ780G6P1M#kXUbcVjBlXPJ";
|
||||
let output = "sujets.zip";
|
||||
|
||||
if let Err(e) = download_file(url, output) {
|
||||
eprintln!("❌ Erreur: {}", e);
|
||||
}
|
||||
}
|
||||
1
get_bac_subject/get_bac_subject/url.txt
Normal file
1
get_bac_subject/get_bac_subject/url.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://drive.proton.me/urls/XZ780G6P1M#kXUbcVjBlXPJ
|
||||
@@ -161,5 +161,37 @@ if __name__ == "__main__":
|
||||
liste1
|
||||
) # on observer que la liste devient triée (logique car on la trie pour la mettre dans l'arbre et on ne peut pas la recupérer comme si elle ne l'etait pas)
|
||||
|
||||
# Exercice 5 ?
|
||||
pass
|
||||
tas = [1, 5, 8, 10, 11, 12, 18, 19, 20, 23, 29, 73]
|
||||
|
||||
|
||||
def ajouter(tas, element):
|
||||
tas.append(element)
|
||||
i = len(tas) - 1
|
||||
|
||||
while i > 0:
|
||||
parent = (i - 1) // 2
|
||||
if tas[i] < tas[parent]:
|
||||
tas[i], tas[parent] = tas[parent], tas[i]
|
||||
i = parent
|
||||
else:
|
||||
break
|
||||
|
||||
|
||||
|
||||
# nlog(n)
|
||||
class Tas_Max(object):
|
||||
@staticmethod
|
||||
def parent(i):
|
||||
return (i-1)//2
|
||||
@staticmethod
|
||||
|
||||
def enfant_gauche(i):
|
||||
return 2*i+1
|
||||
@staticmethod
|
||||
|
||||
def enfant_droite(i):
|
||||
return 2*i+2
|
||||
# exercice 6:1. Proposer une méthode d’extraction de la racine.
|
||||
def extract_racine(tas):
|
||||
racine = tas.pop()
|
||||
|
||||
|
||||
0
trees/ABR/main.py
Normal file
0
trees/ABR/main.py
Normal file
Reference in New Issue
Block a user