Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
263 additions
and
0 deletions.
There are no files selected for viewing
168 changes: 168 additions & 0 deletions
168
cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/Cargo.lock
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "adt_easy_20240314_2" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# dependencies added to new project | ||
[dependencies] | ||
ac-library-rs = "=0.1.1" | ||
num = "=0.4.0" | ||
proconio = { version = "=0.4.3", features = ["derive"] } | ||
superslice = "=1.0.0" | ||
|
||
[profile.release] | ||
lto = true | ||
panic = 'abort' |
1 change: 1 addition & 0 deletions
1
cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/rust-toolchain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.70.0 |
11 changes: 11 additions & 0 deletions
11
cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/src/bin/a.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use proconio::{input, marker::Usize1}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
k: Usize1, | ||
a: Usize1, | ||
}; | ||
let ans = (a + k) % n + 1; | ||
println!("{}", ans); | ||
} |
10 changes: 10 additions & 0 deletions
10
cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/src/bin/b.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
a: usize, | ||
b: usize, | ||
}; | ||
let ans = a.pow(b as u32); | ||
println!("{}", ans); | ||
} |
9 changes: 9 additions & 0 deletions
9
cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/src/bin/c.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
x: i64 | ||
}; | ||
let ans = num::Integer::div_floor(&x, &10); | ||
println!("{}", ans); | ||
} |
26 changes: 26 additions & 0 deletions
26
cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/src/bin/d.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use std::collections::HashMap; | ||
|
||
use proconio::{input, marker::Usize1}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
ab: [(Usize1, Usize1); n - 1], | ||
}; | ||
let mut edges = vec![vec![]; n]; | ||
for (a, b) in ab { | ||
edges[a].push(b); | ||
edges[b].push(a); | ||
} | ||
|
||
let mut map = HashMap::new(); | ||
for e in edges { | ||
*map.entry(e.len()).or_insert(0) += 1; | ||
} | ||
|
||
let mut m = HashMap::new(); | ||
m.insert(n - 1, 1); | ||
m.insert(1, n - 1); | ||
let ans = m == map; | ||
println!("{}", if ans { "Yes" } else { "No" }); | ||
} |
23 changes: 23 additions & 0 deletions
23
cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/src/bin/e.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use proconio::input; | ||
|
||
fn f(ans: &mut Vec<char>, n: usize) { | ||
if n == 0 { | ||
return; | ||
} | ||
if n > 1 && n % 2 == 0 { | ||
ans.push('B'); | ||
f(ans, n / 2); | ||
} else { | ||
ans.push('A'); | ||
f(ans, n - 1); | ||
} | ||
} | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
} | ||
let mut ans = vec![]; | ||
f(&mut ans, n); | ||
println!("{}", ans.into_iter().rev().collect::<String>()); | ||
} |