ABC 045, not finished yet, got idea for c
This commit is contained in:
25
atcoder/beginner_contests/abc045/Cargo.lock
generated
Normal file
25
atcoder/beginner_contests/abc045/Cargo.lock
generated
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "abc045"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"proconio",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazy_static"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proconio"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "91c333be3af2936f8e810300bc74fe4d0cc168ebc04ab02a28c5b1060fa1bd59"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
]
|
||||||
12
atcoder/beginner_contests/abc045/Cargo.toml
Normal file
12
atcoder/beginner_contests/abc045/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[package]
|
||||||
|
name = "abc045"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# dependencies added to new project
|
||||||
|
[dependencies]
|
||||||
|
proconio = "0.4.3"
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = true
|
||||||
|
panic = 'abort'
|
||||||
13
atcoder/beginner_contests/abc045/src/bin/a.rs
Normal file
13
atcoder/beginner_contests/abc045/src/bin/a.rs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
use proconio::input;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
input!{
|
||||||
|
a: u16,
|
||||||
|
b: u16,
|
||||||
|
h: u16,
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = h * (a + b) / 2;
|
||||||
|
|
||||||
|
println!("{}", {result});
|
||||||
|
}
|
||||||
64
atcoder/beginner_contests/abc045/src/bin/b.rs
Normal file
64
atcoder/beginner_contests/abc045/src/bin/b.rs
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
use proconio::input;
|
||||||
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
|
enum Winner {
|
||||||
|
Alice,
|
||||||
|
Bob,
|
||||||
|
Charlie,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_char(c: char) -> Winner {
|
||||||
|
let result : Winner;
|
||||||
|
|
||||||
|
match c {
|
||||||
|
'a' => result = Winner::Alice,
|
||||||
|
'b' => result = Winner::Bob,
|
||||||
|
_ => result = Winner::Charlie,
|
||||||
|
}
|
||||||
|
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
input!{
|
||||||
|
sa: String,
|
||||||
|
sb: String,
|
||||||
|
sc: String,
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut alice : VecDeque<char> = sa.chars().collect();
|
||||||
|
let mut bob : VecDeque<char> = sb.chars().collect();
|
||||||
|
let mut charlie : VecDeque<char> = sc.chars().collect();
|
||||||
|
|
||||||
|
let mut winner = Winner::Alice;
|
||||||
|
|
||||||
|
loop {
|
||||||
|
if let Winner::Alice = winner {
|
||||||
|
let p = alice.pop_front();
|
||||||
|
match p {
|
||||||
|
None => break,
|
||||||
|
Some(c) => winner = parse_char(c),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Winner::Bob = winner {
|
||||||
|
let p = bob.pop_front();
|
||||||
|
match p {
|
||||||
|
None => break,
|
||||||
|
Some(c) => winner = parse_char(c),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Winner::Charlie = winner {
|
||||||
|
let p = charlie.pop_front();
|
||||||
|
match p {
|
||||||
|
None => break,
|
||||||
|
Some(c) => winner = parse_char(c),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
match winner {
|
||||||
|
Winner::Alice => println!("A"),
|
||||||
|
Winner::Bob => println!("B"),
|
||||||
|
Winner::Charlie => println!("C"),
|
||||||
|
}
|
||||||
|
}
|
||||||
14
atcoder/beginner_contests/abc045/src/bin/c.rs
Normal file
14
atcoder/beginner_contests/abc045/src/bin/c.rs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
use proconio::input;
|
||||||
|
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
input!{
|
||||||
|
s: String,
|
||||||
|
};
|
||||||
|
|
||||||
|
let ns : Vec<u64> = s.chars().map(|c| u64::from(c.to_digit(10).unwrap())).collect();
|
||||||
|
let nns = vec![ns];
|
||||||
|
let mut result : u64 = 0;
|
||||||
|
|
||||||
|
println!("{}", {result});
|
||||||
|
}
|
||||||
5
atcoder/beginner_contests/abc045/src/bin/d.rs
Normal file
5
atcoder/beginner_contests/abc045/src/bin/d.rs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
use proconio::input;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user