結果
| 問題 |
No.1231 Make a Multiple of Ten
|
| コンテスト | |
| ユーザー |
Strorkis
|
| 提出日時 | 2020-09-18 22:01:55 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 2,000 ms |
| コード長 | 982 bytes |
| コンパイル時間 | 12,164 ms |
| コンパイル使用メモリ | 401,904 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 13:48:56 |
| 合計ジャッジ時間 | 13,391 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
macro_rules! read_line_to_tuple {
( $( $t:ty ),* ) => {{
let mut input = String::new();
std::io::stdin().read_line(&mut input).unwrap();
let mut iter = input.split_whitespace();
( $( iter.next().unwrap().parse::<$t>().unwrap() ),* )
}};
}
macro_rules! read_line_to_collection {
( $t:ty ) => {{
let mut input = String::new();
std::io::stdin().read_line(&mut input).unwrap();
let iter = input.split_whitespace();
iter.map(|x| x.parse().unwrap()).collect::<$t>()
}};
}
use std::cmp::max;
fn main() {
let _n = read_line_to_tuple!(usize);
let a = read_line_to_collection!(Vec<i32>);
let mut old = vec![std::i32::MIN; 10];
old[0] = 0;
for x in a.iter().map(|x| x % 10) {
let mut new = old.clone();
for i in 0..10 {
let j = (i + x as usize) % 10;
new[j] = max(new[j], old[i] + 1);
}
old = new;
}
println!("{}", old[0]);
}
Strorkis