Skip to content

Commit

Permalink
abc332 a, b
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Dec 21, 2023
1 parent 0684e38 commit f901412
Show file tree
Hide file tree
Showing 10 changed files with 282 additions and 0 deletions.
169 changes: 169 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc332/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/abc332/Cargo.toml
@@ -0,0 +1,15 @@
[package]
name = "abc332"
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 cargo-atcoder-1.70.0/contests/abc332/rust-toolchain
@@ -0,0 +1 @@
1.70.0
14 changes: 14 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc332/src/bin/a.rs
@@ -0,0 +1,14 @@
use proconio::input;

fn main() {
input! {
n: usize,
s: usize,
k: usize,
pq: [(usize, usize); n],
};
let mut sum = pq.into_iter().map(|(p, q)| p * q).sum::<usize>();
sum += if sum >= s { 0 } else { k };
let ans = sum;
println!("{}", ans);
}
33 changes: 33 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc332/src/bin/b.rs
@@ -0,0 +1,33 @@
use proconio::input;

fn main() {
input! {
capital_k: usize,
capital_g: usize,
capital_m: usize,
};
let mut g = 0_usize;
let mut m = 0_usize;
for _ in 0..capital_k {
if g == capital_g {
g = 0;
} else if m == 0 {
m = capital_m;
} else {
while !(m == 0 || g == capital_g) {
if capital_g > g {
let d1 = capital_g - g;
let d2 = m;
if d1 <= d2 {
g += d1;
m -= d1;
} else {
g += d2;
m -= d2;
}
}
}
}
}
println!("{} {}", g, m);
}
10 changes: 10 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc332/src/bin/c.rs
@@ -0,0 +1,10 @@
use proconio::{input, marker::Usize1};

fn main() {
input! {
n: usize,
a: [Usize1; n],
};
let ans = n - a.len();
println!("{}", ans);
}
10 changes: 10 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc332/src/bin/d.rs
@@ -0,0 +1,10 @@
use proconio::{input, marker::Usize1};

fn main() {
input! {
n: usize,
a: [Usize1; n],
};
let ans = n - a.len();
println!("{}", ans);
}
10 changes: 10 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc332/src/bin/e.rs
@@ -0,0 +1,10 @@
use proconio::{input, marker::Usize1};

fn main() {
input! {
n: usize,
a: [Usize1; n],
};
let ans = n - a.len();
println!("{}", ans);
}
10 changes: 10 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc332/src/bin/f.rs
@@ -0,0 +1,10 @@
use proconio::{input, marker::Usize1};

fn main() {
input! {
n: usize,
a: [Usize1; n],
};
let ans = n - a.len();
println!("{}", ans);
}
10 changes: 10 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc332/src/bin/g.rs
@@ -0,0 +1,10 @@
use proconio::{input, marker::Usize1};

fn main() {
input! {
n: usize,
a: [Usize1; n],
};
let ans = n - a.len();
println!("{}", ans);
}

0 comments on commit f901412

Please sign in to comment.