Skip to content

Commit

Permalink
code-formula-2014-final
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Dec 26, 2020
1 parent 27124cd commit 201bfde
Show file tree
Hide file tree
Showing 11 changed files with 229 additions and 0 deletions.
77 changes: 77 additions & 0 deletions code-formula-2014-final/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions code-formula-2014-final/Cargo.toml
@@ -0,0 +1,14 @@
[package]
name = "code-formula-2014-final"
version = "0.1.0"
authors = ["bouzuya <m@bouzuya.net>"]
edition = "2018"

# dependencies added to new project
[dependencies]
proconio = { version = "=0.3.6", features = ["derive"] }
superslice = "=1.0.0"

[profile.release]
lto = true
panic = 'abort'
1 change: 1 addition & 0 deletions code-formula-2014-final/rust-toolchain
@@ -0,0 +1 @@
1.42.0
10 changes: 10 additions & 0 deletions code-formula-2014-final/src/bin/a.rs
@@ -0,0 +1,10 @@
use proconio::input;

fn main() {
input! {
a: i64,
b: i64,
};
let ans = a * b;
println!("{}", ans);
}
9 changes: 9 additions & 0 deletions code-formula-2014-final/src/bin/b.rs
@@ -0,0 +1,9 @@
use proconio::input;

fn main() {
input! {
n: usize,
};
let ans = n / 2 + if n % 2 == 0 { 0 } else { 3 };
println!("{}", ans);
}
63 changes: 63 additions & 0 deletions code-formula-2014-final/src/bin/c.rs
@@ -0,0 +1,63 @@
use std::collections::BTreeSet;

fn read<T: std::str::FromStr>(
stdin_lock: &mut std::io::StdinLock,
buf: &mut Vec<u8>,
delimiter: u8,
) -> T {
buf.clear();
let _ = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
let s = unsafe { std::str::from_utf8_unchecked(&buf) };
s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
let stdin = std::io::stdin();
let mut stdin_lock = stdin.lock();
let mut buf: Vec<u8> = Vec::new();

let s: String = read(&mut stdin_lock, &mut buf, b'\n');
let s = s.trim_end().chars().collect::<Vec<char>>();

let mut set = BTreeSet::new();
let mut in_name = false;
let mut name = vec![];
for c in s.iter() {
match c {
'@' => {
if in_name {
if !name.is_empty() {
set.insert(name.into_iter().collect::<String>());
name = vec![];
}
}
in_name = true;
}
' ' => {
if in_name {
in_name = false;
if !name.is_empty() {
set.insert(name.into_iter().collect::<String>());
name = vec![];
}
}
}
'a'..='z' => {
if in_name {
name.push(c);
}
}
_ => {
unreachable!();
}
}
}
if in_name {
if !name.is_empty() {
set.insert(name.into_iter().collect::<String>());
}
}
for s in set {
println!("{}", s);
}
}
11 changes: 11 additions & 0 deletions code-formula-2014-final/src/bin/d.rs
@@ -0,0 +1,11 @@
use proconio::input;
use proconio::marker::Usize1;

fn main() {
input! {
n: usize,
a: [Usize1; n],
};
let ans = n - a.len();
println!("{}", ans);
}
11 changes: 11 additions & 0 deletions code-formula-2014-final/src/bin/e.rs
@@ -0,0 +1,11 @@
use proconio::input;
use proconio::marker::Usize1;

fn main() {
input! {
n: usize,
a: [Usize1; n],
};
let ans = n - a.len();
println!("{}", ans);
}
11 changes: 11 additions & 0 deletions code-formula-2014-final/src/bin/f.rs
@@ -0,0 +1,11 @@
use proconio::input;
use proconio::marker::Usize1;

fn main() {
input! {
n: usize,
a: [Usize1; n],
};
let ans = n - a.len();
println!("{}", ans);
}
11 changes: 11 additions & 0 deletions code-formula-2014-final/src/bin/g.rs
@@ -0,0 +1,11 @@
use proconio::input;
use proconio::marker::Usize1;

fn main() {
input! {
n: usize,
a: [Usize1; n],
};
let ans = n - a.len();
println!("{}", ans);
}
11 changes: 11 additions & 0 deletions code-formula-2014-final/src/bin/h.rs
@@ -0,0 +1,11 @@
use proconio::input;
use proconio::marker::Usize1;

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

0 comments on commit 201bfde

Please sign in to comment.