結果
| 問題 |
No.1229 ラグビーの得点パターン
|
| コンテスト | |
| ユーザー |
tzyvrn
|
| 提出日時 | 2020-09-18 23:17:47 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 983 bytes |
| コンパイル時間 | 13,710 ms |
| コンパイル使用メモリ | 402,880 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-22 10:23:09 |
| 合計ジャッジ時間 | 15,473 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 25 |
コンパイルメッセージ
warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:8:23 | 8 | let s = s.trim_right(); | ^^^^^^^^^^ ... 29 | let n = getl!(i64); | ---------- in this macro invocation | = note: `#[warn(deprecated)]` on by default = note: this warning originates in the macro `getl` (in Nightly builds, run with -Z macro-backtrace for more info) help: replace the use of the deprecated method | 8 | let s = s.trim_end(); | ~~~~~~~~
ソースコード
//{{{
#[allow(unused_macros)]
macro_rules! getl {
( $( $t:ty ),* ) => {
{
let mut s = String::new();
std::io::stdin().read_line(&mut s).unwrap();
let s = s.trim_right();
let mut ws = s.split_whitespace();
($(ws.next().unwrap().parse::<$t>().unwrap()),*)
}
};
}
#[allow(unused_macros)]
macro_rules! getl_vec {
( $t:ty ) => {{
let mut s = String::new();
std::io::stdin().read_line(&mut s).unwrap();
let s = s.trim_right();
s.split_whitespace()
.map(|x| x.parse().unwrap())
.collect::<Vec<$t>>()
}};
}
//}}}
fn main() {
let n = getl!(i64);
let mut ans = 0i64;
for i in 0..=(100 / 5) {
for j in 0..=std::cmp::min(i, 100 / 2) {
for k in 0..=(100 / 3) {
if 5 * i + 2 * j + 3 * k == n {
ans += 1;
}
}
}
}
println!("{}", ans);
}
tzyvrn