結果
| 問題 | No.3625 Find Superfibonacci Number |
| コンテスト | |
| ユーザー |
urectanc
|
| 提出日時 | 2026-08-14 22:47:16 |
| 言語 | Rust (1.94.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 80 ms / 2,000 ms |
| + 653µs | |
| コード長 | 952 bytes |
| 記録 | |
| コンパイル時間 | 2,099 ms |
| コンパイル使用メモリ | 193,564 KB |
| 実行使用メモリ | 38,144 KB |
| 最終ジャッジ日時 | 2026-08-14 22:47:21 |
| 合計ジャッジ時間 | 3,224 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
// 3桁を全探索すればいいか
use proconio::{fastout, input};
#[fastout]
fn main() {
input! { t: usize }
for _ in 0..t {
let ans = solve();
println!("{ans}");
}
}
fn solve() -> String {
input! {
k: usize
}
let mut cand = vec![];
for a in 0..10 {
for b in 0..10 {
for c in 0..10 {
if a <= b + c || a + b + c > k {
continue;
}
let rest = k - a - b - c;
let (q, r) = (rest / 9, rest % 9);
let nines = std::iter::repeat_n('9', q).collect::<String>();
let r = if r == 0 { String::new() } else { r.to_string() };
cand.push(format!("{a}{b}{c}{r}{nines}"));
cand.push(format!("{r}{a}{b}{c}{nines}"));
}
}
}
cand.sort_unstable_by(|a, b| a.len().cmp(&b.len()).then(a.cmp(b)));
cand[0].clone()
}
urectanc