Skip to content

Commit

Permalink
abc053 a, b, c, d
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Sep 5, 2023
1 parent 3a56970 commit af095a3
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 0 deletions.
169 changes: 169 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc053/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/abc053/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "abc053"
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/abc053/rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.70.0
9 changes: 9 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc053/src/bin/a.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use proconio::input;

fn main() {
input! {
x: usize,
}
let ans = if x < 1200 { "ABC" } else { "ARC" };
println!("{}", ans);
}
11 changes: 11 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc053/src/bin/b.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use proconio::{input, marker::Chars};

fn main() {
input! {
s: Chars,
}
let l = s.iter().copied().position(|s_i| s_i == 'A').unwrap();
let r = s.iter().copied().rposition(|s_j| s_j == 'Z').unwrap();
let ans = r - l + 1;
println!("{}", ans);
}
15 changes: 15 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc053/src/bin/c.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use proconio::input;

fn main() {
input! {
x: usize,
};
let ans = x / 11 * 2
+ match x % 11 {
0 => 0,
1..=6 => 1,
7..=10 => 2,
_ => unreachable!(),
};
println!("{}", ans);
}
13 changes: 13 additions & 0 deletions cargo-atcoder-1.70.0/contests/abc053/src/bin/d.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use std::collections::HashSet;

use proconio::input;

fn main() {
input! {
n: usize,
a: [usize; n],
};
let count = a.iter().copied().collect::<HashSet<_>>().len();
let ans = if count % 2 == 0 { count - 1 } else { count };
println!("{}", ans);
}

0 comments on commit af095a3

Please sign in to comment.