結果
| 問題 | No.799 赤黒かーどげぇむ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-08 15:58:44 |
| 言語 | Rust (1.93.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 723 bytes |
| 記録 | |
| コンパイル時間 | 1,341 ms |
| コンパイル使用メモリ | 198,064 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-02-08 15:58:48 |
| 合計ジャッジ時間 | 3,244 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
fn main() {
let stdin = std::io::read_to_string(std::io::stdin()).unwrap();
let mut stdin = stdin.split_ascii_whitespace();
let a: u8 = stdin.next().unwrap().parse().unwrap();
let b: u8 = stdin.next().unwrap().parse().unwrap();
let c: u8 = stdin.next().unwrap().parse().unwrap();
let d: u8 = stdin.next().unwrap().parse().unwrap();
use std::io::Write;
let mut out = std::io::BufWriter::new(std::io::stdout().lock());
out.write_all(output(solve(a, b, c, d)).as_bytes()).unwrap();
}
fn solve(a: u8, b: u8, c: u8, d: u8) -> u16 {
(b - a + 1) as u16 * (d - c + 1) as u16 - (b.min(d) + 1).saturating_sub(a.max(c)) as u16
}
fn output(ans: u16) -> String {
ans.to_string() + "\n"
}