結果
| 問題 |
No.1505 Zero-Product Ranges
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-22 23:10:59 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 322 bytes |
| コンパイル時間 | 14,509 ms |
| コンパイル使用メモリ | 390,384 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-22 23:11:16 |
| 合計ジャッジ時間 | 14,907 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 49 |
ソースコード
use std::io::Read;
fn main() {
let mut s = String::new();
std::io::stdin().read_to_string(&mut s).ok();
let n: Vec<usize> = s.split_whitespace().flat_map(str::parse).collect();
let (mut c, mut d) = (0, 0);
for i in 0..n[0] {
d += 1;
if n[i + 1] == 0 {
c += d * (n[0] - i);
d = 0;
}
}
println!("{c}")
}