結果

問題 No.634 硬貨の枚数1
ユーザー NoNo
提出日時 2018-01-26 01:44:45
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 827 bytes
コンパイル時間 2,575 ms
コンパイル使用メモリ 109,404 KB
実行使用メモリ 23,600 KB
最終ジャッジ日時 2023-08-27 05:56:01
合計ジャッジ時間 15,098 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
23,580 KB
testcase_01 AC 57 ms
23,480 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 58 ms
23,500 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 57 ms
21,444 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 57 ms
21,488 KB
testcase_12 WA -
testcase_13 AC 57 ms
21,360 KB
testcase_14 AC 76 ms
23,400 KB
testcase_15 AC 199 ms
23,408 KB
testcase_16 AC 116 ms
19,444 KB
testcase_17 AC 131 ms
21,464 KB
testcase_18 AC 116 ms
19,408 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 215 ms
23,416 KB
testcase_22 AC 192 ms
23,340 KB
testcase_23 AC 112 ms
21,360 KB
testcase_24 AC 57 ms
21,436 KB
testcase_25 AC 57 ms
21,484 KB
testcase_26 AC 56 ms
19,284 KB
testcase_27 AC 57 ms
23,600 KB
testcase_28 AC 56 ms
21,440 KB
testcase_29 AC 57 ms
23,412 KB
testcase_30 AC 55 ms
21,436 KB
testcase_31 AC 56 ms
21,376 KB
testcase_32 AC 54 ms
21,372 KB
testcase_33 AC 54 ms
19,372 KB
testcase_34 AC 61 ms
21,632 KB
testcase_35 AC 99 ms
23,396 KB
testcase_36 AC 152 ms
21,548 KB
testcase_37 AC 122 ms
21,548 KB
testcase_38 AC 74 ms
19,412 KB
testcase_39 AC 192 ms
21,628 KB
testcase_40 AC 149 ms
21,568 KB
testcase_41 AC 139 ms
23,484 KB
testcase_42 AC 186 ms
21,548 KB
testcase_43 AC 110 ms
21,416 KB
testcase_44 AC 57 ms
21,464 KB
testcase_45 AC 59 ms
21,516 KB
testcase_46 AC 73 ms
21,424 KB
testcase_47 WA -
testcase_48 AC 56 ms
23,500 KB
testcase_49 WA -
testcase_50 AC 222 ms
21,452 KB
testcase_51 AC 74 ms
21,456 KB
testcase_52 AC 57 ms
21,316 KB
testcase_53 AC 55 ms
21,456 KB
testcase_54 AC 55 ms
21,456 KB
testcase_55 AC 218 ms
23,504 KB
testcase_56 AC 221 ms
21,420 KB
testcase_57 AC 219 ms
21,572 KB
testcase_58 AC 216 ms
23,500 KB
testcase_59 AC 215 ms
21,444 KB
testcase_60 AC 211 ms
21,504 KB
testcase_61 AC 214 ms
21,452 KB
testcase_62 AC 209 ms
21,508 KB
testcase_63 AC 214 ms
21,516 KB
testcase_64 AC 217 ms
21,460 KB
testcase_65 AC 210 ms
21,420 KB
testcase_66 AC 219 ms
21,424 KB
testcase_67 AC 219 ms
21,420 KB
testcase_68 AC 219 ms
21,364 KB
testcase_69 AC 218 ms
21,432 KB
testcase_70 AC 212 ms
21,532 KB
testcase_71 AC 214 ms
21,352 KB
testcase_72 AC 214 ms
21,500 KB
testcase_73 AC 214 ms
21,500 KB
testcase_74 AC 212 ms
21,468 KB
testcase_75 AC 211 ms
21,500 KB
testcase_76 AC 57 ms
23,480 KB
testcase_77 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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>();

            int y = (int)Math.Sqrt(n) + 1;
            for (int i = 1; i <= y; 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