結果
| 問題 |
No.721 Die tertia (ディエ・テルツィア)
|
| コンテスト | |
| ユーザー |
らすたしあん
|
| 提出日時 | 2018-08-03 23:18:55 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 761 bytes |
| コンパイル時間 | 11,747 ms |
| コンパイル使用メモリ | 390,432 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 17:40:36 |
| 合計ジャッジ時間 | 12,657 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
use std::io::{stdin, Read};
fn main() {
let mut buf = String::new();
stdin().read_to_string(&mut buf).unwrap();
let mut tok = buf.split_whitespace();
let mut get = || tok.next().unwrap();
let mut s = get().split('/');
let mut get = || s.next().unwrap();
let mut y: i32 = get().parse().unwrap();
let mut m: i32 = get().parse().unwrap();
let mut d: i32 = get().parse().unwrap();
d += 2;
let next_d = match m {
4|6|9|11 => 30,
2 => if (y % 4 == 0 && y % 100 != 0) || y % 400 == 0 { 29 } else { 28 },
_ => 31,
};
if d > next_d {
d -= next_d;
m += 1;
if m > 12 {
m = 1;
y += 1;
}
}
println!("{:4}/{:02}/{:02}", y, m, d);
}
らすたしあん