結果
問題 |
No.3156 Count That Day's N
|
ユーザー |
|
提出日時 | 2025-05-24 02:10:21 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 19 ms / 3,000 ms |
コード長 | 619 bytes |
コンパイル時間 | 11,928 ms |
コンパイル使用メモリ | 400,960 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-05-24 02:10:36 |
合計ジャッジ時間 | 13,815 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
コンパイルメッセージ
warning: variable `K` should have a snake case name --> src/main.rs:6:9 | 6 | K: usize, N: usize | ^ help: convert the identifier to snake case (notice the capitalization): `k` | = note: `#[warn(non_snake_case)]` on by default warning: variable `N` should have a snake case name --> src/main.rs:6:19 | 6 | K: usize, N: usize | ^ help: convert the identifier to snake case: `n`
ソースコード
use std::collections::HashSet; use proconio::input; fn main() { input! { K: usize, N: usize } let mut set = HashSet::new(); for x6 in (1_usize..).map(|x| x.pow(6)).take_while(|&x6| x6 <= N) { for y4 in (1_usize..).map(|y| y.pow(4)).take_while(|&y4| x6 + y4 <= N) { let n = x6 + y4; if n % K != 0 { continue; } let m = n / K; let z = f64::sqrt(m as f64) as usize; if z * z == m || (z + 1) * (z + 1) == m { set.insert(n); } } } println!("{}", set.len()); }