結果

問題 No.634 硬貨の枚数1
ユーザー No
提出日時 2018-01-26 01:43:13
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 784 bytes
コンパイル時間 4,465 ms
コンパイル使用メモリ 105,984 KB
実行使用メモリ 233,620 KB
最終ジャッジ日時 2024-12-26 15:52:18
合計ジャッジ時間 158,616 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 3 TLE * 46
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Generic;
using System.Linq;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var li = new List<int>();

            for (int i = 1; i <= n; i++)
            {
                li.Add(i * (i + 1) / 2);
            }

            for (int i = 0; i < li.Count; i++)
            {
                if (n == li[i])
                {
                    Console.WriteLine(1);
                    return;
                }
                if (li.Count(x => x + li[i] == n) > 0)
                {
                    Console.WriteLine(2);
                    return;
                }
            }

            Console.WriteLine(3);

        }
    }
}
0