結果
| 問題 |
No.188 HAPPY DAY
|
| ユーザー |
tttts
|
| 提出日時 | 2020-02-21 15:51:25 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 1,000 ms |
| コード長 | 3,548 bytes |
| コンパイル時間 | 1,194 ms |
| コンパイル使用メモリ | 114,948 KB |
| 実行使用メモリ | 17,792 KB |
| 最終ジャッジ日時 | 2024-10-08 19:48:02 |
| 合計ジャッジ時間 | 1,995 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
class Program
{
static void Main(string[] args)
{
int cnt = 0;
for (int i=1; i<=12; i++)
{
switch (i)
{
case 1:
for (int j = 1; j <= 31; j++)
{
calc(i, j);
}
break;
case 2:
for (int j= 1; j <= 28; j++)
{
calc(i, j);
}
break;
case 3:
for (int j = 1; j <= 31; j++)
{
calc(i, j);
}
break;
case 4:
for (int j = 1; j <= 30; j++)
{
calc(i, j);
}
break;
case 5:
for (int j = 1; j <= 31; j++)
{
calc(i, j);
}
break;
case 6:
for (int j = 1; j <= 30; j++)
{
calc(i, j);
}
break;
case 7:
for (int j = 1; j <= 31; j++)
{
calc(i, j);
}
break;
case 8:
for (int j = 1; j <= 31; j++)
{
calc(i, j);
}
break;
case 9:
for (int j = 1; j <= 30; j++)
{
calc(i, j);
}
break;
case 10:
for (int j = 1; j <= 31; j++)
{
calc(i, j);
}
break;
case 11:
for (int j = 1; j <= 30; j++)
{
calc(i, j);
}
break;
case 12:
for (int j = 1; j <= 31; j++)
{
calc(i, j);
}
break;
}
}
Console.WriteLine(cnt);
void calc(int num1, int num2)
{
int month = num1;
string strday = num2.ToString();
if (strday.Length == 2)
{
char[] day = strday.ToCharArray();
int day1 = int.Parse(day[0].ToString());
int day2 = int.Parse(day[1].ToString());
if (month == day1 + day2)
{
cnt++;
}
}
else if (strday.Length == 1)
{
int day1 = int.Parse(strday);
if (month == day1)
{
cnt++;
}
}
}
}
}
tttts