提出 #39380320
ソースコード 拡げる
use proconio::input;
fn main() {
input! {
t: usize,
case: [usize; t],
};
for capital_n in case {
let mut max = 1_usize;
for len in 2..=18 {
let mut ng = capital_n;
let mut ok = 1;
while ng - ok > 1 {
let m = ok + (ng - ok) / 2;
match m.to_string().repeat(len).parse::<usize>() {
Ok(x) if x <= capital_n => ok = m,
_ => ng = m,
}
}
match ok.to_string().repeat(len).parse::<usize>() {
Ok(n) if n <= capital_n => max = max.max(n),
_ => {}
}
}
println!("{}", max);
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Periodic Number |
| ユーザ | bouzuya |
| 言語 | Rust (1.42.0) |
| 得点 | 400 |
| コード長 | 723 Byte |
| 結果 | AC |
| 実行時間 | 887 ms |
| メモリ | 2344 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00-sample-001.txt |
| All | 00-sample-001.txt, 01-random-001.txt, 01-random-002.txt, 01-random-003.txt, 01-random-004.txt, 01-random-005.txt, 01-random-006.txt, 01-random-007.txt, 01-random-008.txt, 01-random-009.txt, 01-random-010.txt, 02-hand-001.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00-sample-001.txt | AC | 6 ms | 2096 KiB |
| 01-random-001.txt | AC | 887 ms | 2228 KiB |
| 01-random-002.txt | AC | 874 ms | 2296 KiB |
| 01-random-003.txt | AC | 878 ms | 2272 KiB |
| 01-random-004.txt | AC | 869 ms | 2196 KiB |
| 01-random-005.txt | AC | 871 ms | 2200 KiB |
| 01-random-006.txt | AC | 875 ms | 2200 KiB |
| 01-random-007.txt | AC | 873 ms | 2320 KiB |
| 01-random-008.txt | AC | 875 ms | 2344 KiB |
| 01-random-009.txt | AC | 873 ms | 2336 KiB |
| 01-random-010.txt | AC | 870 ms | 2332 KiB |
| 02-hand-001.txt | AC | 862 ms | 2308 KiB |