結果
| 問題 |
No.47 ポケットを叩くとビスケットが2倍
|
| コンテスト | |
| ユーザー |
tera_3939
|
| 提出日時 | 2017-07-14 00:21:39 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 414 bytes |
| コンパイル時間 | 11,139 ms |
| コンパイル使用メモリ | 396,688 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-07 18:36:36 |
| 合計ジャッジ時間 | 12,076 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 19 WA * 2 |
ソースコード
/* https://yukicoder.me/problems/89 */
use std::io;
fn calc(n: u32, c: u32) -> u32{
if n == 0 {
c
} else if n % 2 == 0 {
calc(n / 2, c + 1)
} else {
calc((n - 1) / 2, c + 1)
}
}
fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
let n: u32 = input.trim().parse().unwrap();
let c = calc(n, 0);
println!("{:?}", c);
}
tera_3939