-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,998 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "abc215" | ||
version = "0.1.0" | ||
authors = ["bouzuya <m@bouzuya.net>"] | ||
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.42.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
s: String, | ||
}; | ||
let ans = s == "Hello,World!"; | ||
println!("{}", if ans { "AC" } else { "WA" }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use std::cmp; | ||
|
||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
}; | ||
let mut max = 0_usize; | ||
for k in 0.. { | ||
match 2_usize.checked_pow(k as u32) { | ||
Some(x) => { | ||
if x > n { | ||
break; | ||
} | ||
} | ||
None => break, | ||
} | ||
max = cmp::max(max, k); | ||
} | ||
let ans = max; | ||
println!("{}", ans); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use std::collections::BTreeSet; | ||
|
||
use proconio::{input, marker::Chars}; | ||
use superslice::Ext; | ||
|
||
fn main() { | ||
input! { | ||
s: Chars, | ||
k: usize, | ||
}; | ||
let n = s.len(); | ||
let mut is = (0..n).collect::<Vec<usize>>(); | ||
let mut set = BTreeSet::new(); | ||
loop { | ||
let mut t = vec![]; | ||
for i in is.clone() { | ||
t.push(s[i]); | ||
} | ||
set.insert(t.iter().collect::<String>()); | ||
if !is.next_permutation() { | ||
break; | ||
} | ||
} | ||
println!("{}", set.iter().nth(k - 1).unwrap()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use std::collections::HashSet; | ||
|
||
use proconio::input; | ||
|
||
fn f(n: usize) -> HashSet<usize> { | ||
let mut p = HashSet::new(); | ||
if n < 2 { | ||
return p; | ||
} | ||
let mut n = n; // shadowing | ||
for i in 2.. { | ||
if i * i > n { | ||
break; | ||
} | ||
let mut c = 0; | ||
while n % i == 0 { | ||
c += 1; | ||
n /= i; | ||
} | ||
if c > 0 { | ||
p.insert(i); | ||
} | ||
} | ||
if n != 1 { | ||
p.insert(n); | ||
} | ||
p | ||
} | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
m: usize, | ||
a: [usize; n], | ||
}; | ||
let mut set = HashSet::new(); | ||
for a_i in a.iter().copied() { | ||
for k in f(a_i) { | ||
set.insert(k); | ||
} | ||
} | ||
let mut b = vec![true; m + 1]; | ||
for x in 1..=m { | ||
if b[x] && set.contains(&x) { | ||
b[x] = false; | ||
for j in (x + x..=m).step_by(x) { | ||
b[j] = false; | ||
} | ||
} | ||
} | ||
let mut ans = vec![]; | ||
for x in 1..=m { | ||
if b[x] { | ||
ans.push(x); | ||
} | ||
} | ||
|
||
println!("{}", ans.len()); | ||
for x in ans { | ||
println!("{}", x); | ||
} | ||
} |
Oops, something went wrong.