結果

問題 No.188 HAPPY DAY
ユーザー sasamesasame
提出日時 2017-05-10 10:52:35
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 1,000 ms
コード長 1,269 bytes
コンパイル時間 2,347 ms
コンパイル使用メモリ 105,632 KB
実行使用メモリ 21,804 KB
最終ジャッジ日時 2023-08-29 22:33:55
合計ジャッジ時間 2,869 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
21,804 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public class Program{
  public static void Main(){
    List<int> days = Enumerable.Range(1,31).ToList<int>();
    List<int> _d = days.Select(s => GetDaySum(s)).ToList<int>();
    int overCount = _d.Where(w => w == 1 || w == 2 || w == 3 || w == 4  || w == 5  || w == 6
                               || w == 7 || w == 8 || w == 9 || w == 10 || w == 11 || w == 12)
                      .Count();
    int outCount = 0;
    var _out = new List<Out>();
    _out.Add(new Out(2,29));
    _out.Add(new Out(2,30));
    _out.Add(new Out(2,31));
    _out.Add(new Out(4,31));
    _out.Add(new Out(6,31));
    _out.Add(new Out(9,31));
    _out.Add(new Out(11,31));
    foreach (var o in _out){
      if (o.Month == GetDaySum(o.Day)){
        outCount++;
      }
    }
    Console.WriteLine(overCount - outCount);
  }
  public static int GetDaySum(int d){
    if (d < 10) return d;
    string _d = d.ToString();
    int ten = int.Parse(_d.Substring(0,1));
    int one = int.Parse(_d.Substring(1,1));
    return ten + one;
  }
}
public class Out{
    public int Month { get; set; }
    public int Day { get; set; }
    public Out(int m, int d){
        Month = m;
        Day = d;
    }
}
0