結果
問題 | No.188 HAPPY DAY |
ユーザー |
![]() |
提出日時 | 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;//1for (int i = 1; i <= 31; i++){if (isHappy(1, i) == true) cnt++;}//2for (int i = 1; i <= 29; i++){if (isHappy(2, i) == true) cnt++;}//3for (int i = 1; i <= 31; i++){if (isHappy(3, i) == true) cnt++;}//4for (int i = 1; i <= 30; i++){if (isHappy(4, i) == true) cnt++;}//5for (int i = 1; i <= 31; i++){if (isHappy(5, i) == true) cnt++;}//6for (int i = 1; i <= 30; i++){if (isHappy(6, i) == true) cnt++;}//7for (int i = 1; i <= 31; i++){if (isHappy(7, i) == true) cnt++;}//8for (int i = 1; i <= 31; i++){if (isHappy(8, i) == true) cnt++;}//9for (int i = 1; i <= 30; i++){if (isHappy(9, i) == true) cnt++;}//10for (int i = 1; i <= 31; i++){if (isHappy(10, i) == true) cnt++;}//11for (int i = 1; i <= 30; i++){if (isHappy(11, i) == true) cnt++;}//12for (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;}}}