結果
問題 | No.2766 Delicious Multiply Spice |
ユーザー | Sai Srinivas A |
提出日時 | 2024-05-31 21:42:20 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 910 bytes |
コンパイル時間 | 12,533 ms |
コンパイル使用メモリ | 405,520 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-05-31 21:42:35 |
合計ジャッジ時間 | 13,796 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | AC | 1 ms
6,940 KB |
testcase_02 | AC | 1 ms
6,940 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | AC | 0 ms
6,940 KB |
testcase_07 | AC | 1 ms
6,940 KB |
testcase_08 | AC | 1 ms
6,940 KB |
testcase_09 | AC | 1 ms
6,944 KB |
testcase_10 | AC | 1 ms
6,944 KB |
testcase_11 | AC | 1 ms
6,944 KB |
testcase_12 | AC | 1 ms
6,940 KB |
testcase_13 | AC | 1 ms
6,944 KB |
testcase_14 | AC | 1 ms
6,944 KB |
testcase_15 | AC | 1 ms
6,944 KB |
testcase_16 | AC | 1 ms
6,940 KB |
testcase_17 | AC | 1 ms
6,944 KB |
testcase_18 | AC | 1 ms
6,944 KB |
testcase_19 | AC | 1 ms
6,944 KB |
testcase_20 | AC | 1 ms
6,944 KB |
testcase_21 | AC | 0 ms
6,940 KB |
testcase_22 | AC | 1 ms
6,940 KB |
testcase_23 | AC | 1 ms
6,940 KB |
testcase_24 | AC | 1 ms
6,940 KB |
testcase_25 | AC | 1 ms
6,944 KB |
testcase_26 | AC | 1 ms
6,940 KB |
testcase_27 | AC | 1 ms
6,940 KB |
testcase_28 | AC | 1 ms
6,940 KB |
testcase_29 | AC | 1 ms
6,944 KB |
testcase_30 | AC | 1 ms
6,940 KB |
testcase_31 | AC | 1 ms
6,940 KB |
testcase_32 | AC | 1 ms
6,944 KB |
testcase_33 | AC | 1 ms
6,944 KB |
testcase_34 | AC | 1 ms
6,944 KB |
testcase_35 | AC | 1 ms
6,940 KB |
testcase_36 | AC | 1 ms
6,940 KB |
testcase_37 | AC | 1 ms
6,944 KB |
testcase_38 | AC | 1 ms
6,940 KB |
コンパイルメッセージ
warning: unused import: `std::cmp::max` --> src/main.rs:1:5 | 1 | use std::cmp::max; | ^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused variable: `test_cases` --> src/main.rs:27:9 | 27 | let test_cases:u32; | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_test_cases` | = note: `#[warn(unused_variables)]` on by default warning: variable `INPUT` should have a snake case name --> src/main.rs:29:13 | 29 | let mut INPUT = io::BufReader::new(stdin.lock()).lines().map(Result::unwrap); | ^^^^^ help: convert the identifier to snake case: `input` | = note: `#[warn(non_snake_case)]` on by default warning: variable `OUTPUT` should have a snake case name --> src/main.rs:30:13 | 30 | let mut OUTPUT = io::BufWriter::new(io::stdout().lock()); | ^^^^^^ help: convert the identifier to snake case: `output` warning: unused `Result` that must be used --> src/main.rs:37:5 | 37 | writeln!(OUTPUT, "{}", solve(n).unwrap()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled = note: `#[warn(unused_must_use)]` on by default = note: this warning originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
ソースコード
use std::cmp::max; use std::io; use std::io::{Write, BufRead}; fn solve(n:u64) -> Option<String>{ if n == 1{return Some(String::new());} let n = n-1; if n %2 ==0 { if let Some(mut s) = solve(n/2){ s.push('A'); return Some(s); } } if n %3 ==0 { if let Some(mut s) = solve(n/3){ s.push('B'); return Some(s); } } None } pub fn main(){ let test_cases:u32; let stdin = io::stdin(); let mut INPUT = io::BufReader::new(stdin.lock()).lines().map(Result::unwrap); let mut OUTPUT = io::BufWriter::new(io::stdout().lock()); // test_cases = INPUT.next().unwrap().parse().unwrap(); let n = INPUT.next().unwrap().parse::<u64>().unwrap(); writeln!(OUTPUT, "{}", solve(n).unwrap()); // for _ in 0..test_cases{ // } }