Skip to content

Commit

Permalink
adt_easy_20240314_2
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Mar 18, 2024
1 parent c915ee4 commit 95d61a2
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 0 deletions.
168 changes: 168 additions & 0 deletions 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.

15 changes: 15 additions & 0 deletions cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/Cargo.toml
@@ -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'
@@ -0,0 +1 @@
1.70.0
11 changes: 11 additions & 0 deletions cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/src/bin/a.rs
@@ -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 cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/src/bin/b.rs
@@ -0,0 +1,10 @@
use proconio::input;

fn main() {
input! {
a: usize,
b: usize,
};
let ans = a.pow(b as u32);
println!("{}", ans);
}
@@ -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 cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/src/bin/d.rs
@@ -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 cargo-atcoder-1.70.0/contests/adt_easy_20240314_2/src/bin/e.rs
@@ -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>());
}

0 comments on commit 95d61a2

Please sign in to comment.