結果
| 問題 | No.887 Collatz |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-14 13:28:07 |
| 言語 | Rust (1.99.0 + proconio + num + itertools + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 157µs | |
| コード長 | 324 bytes |
| 記録 | |
| コンパイル時間 | 10,880 ms |
| コンパイル使用メモリ | 179,536 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-10-14 13:28:21 |
| 合計ジャッジ時間 | 5,577 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
コンパイルメッセージ
warning: variable does not need to be mutable --> src/main.rs:7:9 | 7 | let mut num=0; | ----^^^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default warning: unused variable: `num` --> src/main.rs:7:9 | 7 | let mut num=0; | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_num` | = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
ソースコード
use proconio::input;
fn main(){
input!{
mut x:usize,
}
let mut ans=x;
let mut num=0;
let mut c=0;
while x>1{
if x%2==0{
x/=2;
} else {
x*=3;x+=1;
}
c+=1;
if ans<x{
ans=x;
}
}
print!("{}\n{}",c,ans);
}