結果
| 問題 | No.3402 [Cherry Anniversary 5] Beyond Zelkova, the 5th year vista seen through the bloom of a cherry bloosom |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-03-02 13:29:52 |
| 言語 | Rust (1.93.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 1,347 bytes |
| 記録 | |
| コンパイル時間 | 15,447 ms |
| コンパイル使用メモリ | 197,996 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-03-02 13:32:48 |
| 合計ジャッジ時間 | 3,942 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 24 |
ソースコード
#[allow(unused_imports)]
use proconio::{
input,
marker::{Bytes, Chars, Usize1},
};
use std::cmp::Ordering;
fn main() {
input! {
ys: usize,
ms: usize,
ds: usize,
ye: usize,
me: usize,
de: usize,
q: usize,
ymd: [(usize, usize, usize); q]
}
let ns = total_days(ys, ms, ds);
let ne = total_days(ye, me, de);
let b = ne - ns + 1;
for &(y, m, d) in &ymd {
let nq = total_days(y, m, d);
let a = nq - ne;
let res = match a.cmp(&b) {
Ordering::Less => "Less",
Ordering::Equal => "Same",
Ordering::Greater => "More",
};
println!("{}", res);
}
}
fn isleap(y: usize) -> bool {
if y.is_multiple_of(100) {
return y.is_multiple_of(400);
}
y.is_multiple_of(4)
}
fn days_in_month(y: usize, m: usize) -> usize {
let res = match m {
2 => {
if isleap(y) {
29
} else {
28
}
}
4 | 6 | 9 | 11 => 30,
_ => 31,
};
res
}
fn total_days(y: usize, m: usize, d: usize) -> usize {
let mut res = 0;
for yi in 1933..y {
res += if isleap(yi) { 366 } else { 365 };
}
for mi in 1..m {
res += days_in_month(y, mi);
}
res += d;
res
}