結果
問題 | No.188 HAPPY DAY |
ユーザー |
![]() |
提出日時 | 2019-02-13 12:18:34 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 22 ms / 1,000 ms |
コード長 | 1,270 bytes |
コンパイル時間 | 2,577 ms |
コンパイル使用メモリ | 108,248 KB |
実行使用メモリ | 23,388 KB |
最終ジャッジ日時 | 2024-09-13 09:54:42 |
合計ジャッジ時間 | 2,970 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Collections;public class Hello{static int happyDayCount = 0;static int month = 1;public static void Main(){int day = 0;//string[] input = Console.ReadLine().Split(' ');while (month < 12){day = DecideDay(month);CalculateHappyDay(day);month++;}Console.WriteLine(happyDayCount);}public static int DecideDay(int month){int day = 0;switch (month){case 1:case 3:case 5:case 7:case 8:case 10:case 12:day = 31;break;case 4:case 6:case 9:case 11:day = 30;break;case 2:day = 28;break;}return day;}public static void CalculateHappyDay(int day){for (int i = 1; i <= day; i++){int onesPlace = i % 10;int tensPlace = i / 10;if (month.Equals(onesPlace + tensPlace)){happyDayCount++;}}}}