結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー kat0rikkat0rik
提出日時 2019-08-12 18:44:33
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 640 bytes
コンパイル時間 12,360 ms
コンパイル使用メモリ 216,352 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 07:45:48
合計ジャッジ時間 13,514 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"strconv"
)

//                     1,   2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12
var days = [13]int{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}

func main() {
	var s string
	fmt.Scan(&s)
	y, _ := strconv.Atoi(s[0:4])
	m, _ := strconv.Atoi(s[5:7])
	d, _ := strconv.Atoi(s[8:10])
	if y%4 == 0 && y%100 != 0 && y%400 == 0 {
		// leap year
		days[2] = 29
	}
	// fmt.Println("y", y, "m", m, "d", d, "days", days)
	if d+2 > days[m] {
		if d == days[m] {
			d = 2
		} else {
			d = 1
		}
		if m == 12 {
			m = 1
			y++
		} else {
			m++
		}
	} else {
		d += 2
	}

	fmt.Printf("%04d/%02d/%02d\n", y, m, d)
}
0