rustlang
-
Rust lang) 백준 2108번 통계학Rust 2024. 1. 18. 07:38
오답 // https://www.acmicpc.net/problem/2108 // uncorrected use std::{io::{stdin, BufRead}, collections::{HashMap, hash_map}, result}; pub fn quick_sort(arr: &mut Vec) { let len = arr.len(); _quick_sort(arr, 0, (len - 1) as isize); } fn _quick_sort(arr: &mut Vec, low: isize, high: isize) { if low < high { let p = partition(arr, low, high); _quick_sort(arr, low, p - 1); _quick_sort(arr, p + 1, high..
-
Rust lang) 백준 11047번 동전 0Rust 2024. 1. 18. 07:35
use std::{io::{stdin, BufRead}}; fn main() { let mut coins: Vec= Vec::new(); let mut anwser= 0; let std= stdin(); let mut buf= std.lock().lines(); let n_and_k: Vec= buf.next().unwrap().unwrap() .trim().split_whitespace() .map(|f| f.parse().unwrap()).collect(); let n= n_and_k[0]; let k= move || n_and_k[1]; for i in 0..n { let coin: i32= buf.next().unwrap().unwrap().parse().unwrap(); coins.push(co..
-
Rust lang) leetcode 207. Course ScheduleRust 2024. 1. 11. 22:47
use std::collections::VecDeque; struct Solution{} impl Solution { pub fn can_finish(num_courses: i32, prerequisites: Vec) -> bool { let i = prerequisites.len(); let mut tmp = prerequisites.len(); let size = prerequisites.len(); let mut counter: Vec= vec![0; num_courses as usize]; let mut que:VecDeque= VecDeque::new(); for i in 0..size{ let value= prerequisites[i][0]; counter[value as usize]+=1; ..
-
Rust lang) 백준 15903 카드 합체 놀이Rust 2024. 1. 9. 16:15
// max heap * -1 sort // https://www.acmicpc.net/problem/15903 use std::{io::{stdin, BufRead}, collections::{BinaryHeap}}; fn main() { let std= stdin(); let mut buf= std.lock().lines(); let input= buf.next().unwrap().unwrap(); let nms: Vec= input.trim().split_whitespace().map(|f| f.parse().unwrap()).collect(); let input2= buf.next().unwrap().unwrap(); let As: Vec= input2.trim().split_whitespace(..
-
Rust Lang) 백준 2002 추월Rust 2024. 1. 9. 16:13
// Answer // https://www.acmicpc.net/problem/2002 use std::{io::{stdin, BufRead}, collections::{HashSet, HashMap}}; fn main() { let mut in_cars: HashMap= HashMap::new(); let mut out_cars: HashMap= HashMap::new(); let std= stdin(); let mut buf= std.lock().lines(); let input= buf.next().unwrap().unwrap(); let n: u32= input.parse().unwrap(); for i in 0..n{ let car_nubmer_str= buf.next().unwrap().un..
-
rust lang) 백준 1927 최소 힙Rust 2024. 1. 9. 07:38
// https://www.acmicpc.net/problem/1927 use std::{io::{stdin, BufReader, BufRead}, collections::BinaryHeap}; fn main() { let std= stdin(); let mut buf= std.lock().lines(); let input= buf.next().unwrap().unwrap(); let mut input_str= input.trim().split_whitespace(); let n: i32= input_str.next().unwrap().parse().unwrap(); let mut heap: BinaryHeap= BinaryHeap::new(); for _ in 0..n{ let inner_input= ..
-
Rust lang) 백준 5397 키로거Rust 2024. 1. 9. 07:29
// 백준 5397 키로거 rust // https://www.acmicpc.net/problem/5397 use std::io::{stdin, BufRead}; fn main() { let std= stdin(); let mut buf= std.lock().lines(); let input= buf.next().unwrap().unwrap(); let t: i32= input.trim().parse().unwrap(); let mut inputes: Vec; for _ in 0..t{ let mut left: Vec = Vec::new(); let mut right: Vec = Vec::new(); let input2= buf.next().unwrap().unwrap(); inputes= input2...