Skip to content

Commit

Permalink
abc283 a, b, c, d
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Dec 24, 2022
1 parent 12a9bd5 commit 12ed766
Show file tree
Hide file tree
Showing 11 changed files with 308 additions and 0 deletions.
161 changes: 161 additions & 0 deletions abc283/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 abc283/Cargo.toml
@@ -0,0 +1,14 @@
[package]
name = "abc283"
version = "0.1.0"
edition = "2018"

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

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

fn main() {
input! {
a: usize,
b: usize,
};
let ans = a.pow(b as u32);
println!("{}", ans);
}
27 changes: 27 additions & 0 deletions abc283/src/bin/b.rs
@@ -0,0 +1,27 @@
use proconio::{input, marker::Usize1};

fn main() {
input! {
n: usize,
mut a: [usize; n],
q: usize,
};
for _ in 0..q {
input! {
t: usize,
k: Usize1,
}
match t {
1 => {
input! {
x: usize,
}
a[k] = x;
}
2 => {
println!("{}", a[k]);
}
_ => unreachable!(),
}
}
}
25 changes: 25 additions & 0 deletions abc283/src/bin/c.rs
@@ -0,0 +1,25 @@
use proconio::{input, marker::Chars};

fn main() {
input! {
s: Chars,
};

let mut count = 0_usize;
let mut zero = false;
for c in s {
if c == '0' {
if zero {
zero = false;
} else {
zero = true;
count += 1;
}
} else {
zero = false;
count += 1;
}
}
let ans = count;
println!("{}", ans);
}
30 changes: 30 additions & 0 deletions abc283/src/bin/d.rs
@@ -0,0 +1,30 @@
use proconio::{input, marker::Chars};

fn main() {
input! {
s: Chars,
};
let mut boxes = 0_usize;
let mut stack = vec![];
for (i, c) in s.iter().copied().enumerate() {
match c {
'(' => {
stack.push((i, boxes));
}
')' => {
let (_, bits) = stack.pop().unwrap();
boxes = bits;
}
'a'..='z' => {
let index = (c as u8 - b'a') as usize;
if (boxes & (1 << index)) != 0 {
println!("No");
return;
}
boxes |= 1 << index;
}
_ => unreachable!(),
}
}
println!("Yes");
}
10 changes: 10 additions & 0 deletions abc283/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 abc283/src/bin/ex.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 abc283/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 abc283/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 12ed766

Please sign in to comment.