結果
問題 | No.188 HAPPY DAY |
ユーザー | No |
提出日時 | 2015-04-22 00:40:10 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 27 ms / 1,000 ms |
コード長 | 2,540 bytes |
コンパイル時間 | 993 ms |
コンパイル使用メモリ | 110,592 KB |
実行使用メモリ | 17,408 KB |
最終ジャッジ日時 | 2024-12-30 19:50:12 |
合計ジャッジ時間 | 1,454 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ForYukicoder { class Program { static void Main(string[] args) { int cnt = 0; //1 for (int i = 1; i <= 31; i++) { if (isHappy(1, i) == true) cnt++; } //2 for (int i = 1; i <= 29; i++) { if (isHappy(2, i) == true) cnt++; } //3 for (int i = 1; i <= 31; i++) { if (isHappy(3, i) == true) cnt++; } //4 for (int i = 1; i <= 30; i++) { if (isHappy(4, i) == true) cnt++; } //5 for (int i = 1; i <= 31; i++) { if (isHappy(5, i) == true) cnt++; } //6 for (int i = 1; i <= 30; i++) { if (isHappy(6, i) == true) cnt++; } //7 for (int i = 1; i <= 31; i++) { if (isHappy(7, i) == true) cnt++; } //8 for (int i = 1; i <= 31; i++) { if (isHappy(8, i) == true) cnt++; } //9 for (int i = 1; i <= 30; i++) { if (isHappy(9, i) == true) cnt++; } //10 for (int i = 1; i <= 31; i++) { if (isHappy(10, i) == true) cnt++; } //11 for (int i = 1; i <= 30; i++) { if (isHappy(11, i) == true) cnt++; } //12 for (int i = 1; i <= 31; i++) { if (isHappy(12, i) == true) cnt++; } Console.WriteLine(cnt); Console.ReadLine(); } static bool isHappy(int month, int day) { string strDay = day.ToString(); string strDay2; string strDay3; int a; if (strDay.Length == 2) { strDay2 = strDay.Substring(0, 1); strDay3 = strDay.Substring(1, 1); a = int.Parse(strDay2) + int.Parse(strDay3); } else { a = int.Parse(strDay.Substring(0, 1)); } return (month == a) ? true : false; } } }