結果
| 問題 |
No.903 太郎の確率
|
| コンテスト | |
| ユーザー |
shinozaki
|
| 提出日時 | 2019-11-05 19:48:35 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 427 bytes |
| コンパイル時間 | 13,469 ms |
| コンパイル使用メモリ | 383,204 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-15 00:12:20 |
| 合計ジャッジ時間 | 13,766 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
コンパイルメッセージ
warning: unused import: `std::convert::TryFrom`
--> src/main.rs:2:5
|
2 | use std::convert::TryFrom;
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unnecessary parentheses around `if` condition
--> src/main.rs:16:11
|
16 | if(n < 1 || n > 100) { continue; }
| ^ ^
|
= note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
|
16 - if(n < 1 || n > 100) { continue; }
16 + if n < 1 || n > 100 { continue; }
|
ソースコード
use std::io;
use std::convert::TryFrom;
fn main() {
let stdin = io::stdin();
let mut n: String = String::new();
stdin.read_line(&mut n).ok();
let f:f32;
loop
{
let n:i8 = match n.trim().parse()
{
Ok(num) => num,
Err(_) => continue,
};
if(n < 1 || n > 100) { continue; }
f = 1.0/(n as f32);
break;
}
print!("{:.6}",f);
}
shinozaki