結果

問題 No.634 硬貨の枚数1
ユーザー バカらっくバカらっく
提出日時 2018-01-21 18:24:40
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 1,847 bytes
コンパイル時間 3,732 ms
コンパイル使用メモリ 107,680 KB
実行使用メモリ 22,844 KB
最終ジャッジ日時 2023-08-26 19:57:32
合計ジャッジ時間 12,674 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
20,668 KB
testcase_01 AC 49 ms
20,760 KB
testcase_02 AC 50 ms
20,620 KB
testcase_03 AC 50 ms
20,840 KB
testcase_04 AC 49 ms
22,736 KB
testcase_05 AC 48 ms
20,784 KB
testcase_06 AC 51 ms
20,872 KB
testcase_07 AC 49 ms
18,684 KB
testcase_08 AC 49 ms
20,692 KB
testcase_09 AC 49 ms
20,764 KB
testcase_10 AC 52 ms
20,748 KB
testcase_11 AC 50 ms
20,852 KB
testcase_12 AC 51 ms
20,616 KB
testcase_13 AC 51 ms
20,700 KB
testcase_14 AC 61 ms
20,620 KB
testcase_15 AC 126 ms
20,676 KB
testcase_16 AC 80 ms
20,740 KB
testcase_17 AC 91 ms
20,740 KB
testcase_18 AC 85 ms
18,712 KB
testcase_19 AC 63 ms
22,668 KB
testcase_20 AC 79 ms
20,720 KB
testcase_21 AC 131 ms
22,836 KB
testcase_22 AC 121 ms
22,760 KB
testcase_23 AC 79 ms
20,692 KB
testcase_24 AC 51 ms
18,720 KB
testcase_25 AC 51 ms
20,684 KB
testcase_26 AC 51 ms
18,808 KB
testcase_27 AC 50 ms
20,884 KB
testcase_28 AC 49 ms
20,736 KB
testcase_29 AC 49 ms
20,692 KB
testcase_30 AC 50 ms
20,800 KB
testcase_31 AC 50 ms
20,804 KB
testcase_32 AC 51 ms
22,844 KB
testcase_33 AC 50 ms
22,728 KB
testcase_34 AC 59 ms
20,684 KB
testcase_35 AC 74 ms
20,800 KB
testcase_36 AC 99 ms
22,732 KB
testcase_37 AC 83 ms
20,744 KB
testcase_38 AC 59 ms
22,764 KB
testcase_39 AC 124 ms
22,736 KB
testcase_40 AC 104 ms
18,568 KB
testcase_41 AC 100 ms
20,680 KB
testcase_42 AC 119 ms
22,704 KB
testcase_43 AC 77 ms
20,768 KB
testcase_44 AC 49 ms
20,628 KB
testcase_45 AC 51 ms
20,728 KB
testcase_46 AC 55 ms
20,824 KB
testcase_47 AC 107 ms
20,672 KB
testcase_48 AC 52 ms
20,876 KB
testcase_49 AC 52 ms
20,700 KB
testcase_50 AC 136 ms
20,696 KB
testcase_51 AC 59 ms
20,712 KB
testcase_52 AC 50 ms
20,716 KB
testcase_53 AC 51 ms
20,796 KB
testcase_54 AC 51 ms
18,752 KB
testcase_55 AC 138 ms
20,780 KB
testcase_56 AC 137 ms
20,696 KB
testcase_57 AC 136 ms
20,796 KB
testcase_58 AC 134 ms
20,856 KB
testcase_59 AC 135 ms
20,856 KB
testcase_60 AC 131 ms
20,720 KB
testcase_61 AC 138 ms
22,656 KB
testcase_62 AC 134 ms
22,744 KB
testcase_63 AC 134 ms
20,876 KB
testcase_64 AC 142 ms
20,736 KB
testcase_65 AC 142 ms
22,732 KB
testcase_66 AC 142 ms
20,812 KB
testcase_67 AC 134 ms
20,684 KB
testcase_68 AC 135 ms
20,792 KB
testcase_69 AC 133 ms
18,576 KB
testcase_70 AC 135 ms
20,736 KB
testcase_71 AC 142 ms
20,688 KB
testcase_72 AC 134 ms
20,780 KB
testcase_73 AC 133 ms
20,676 KB
testcase_74 AC 133 ms
22,708 KB
testcase_75 AC 132 ms
20,708 KB
testcase_76 AC 50 ms
20,708 KB
testcase_77 AC 50 ms
20,692 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.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int num = int.Parse(Reader.ReadLine());
        this.SankakuList = this.GetSankakuList(num);
        int ans = 3;
        if(this.SankakuList.Contains(num)) {
            ans = 1;
        } else {
            for (int i = 0; i < this.SankakuList.Count; i++) {
                for (int j = i; j < this.SankakuList.Count; j++) {
                    if(this.SankakuList[i]+this.SankakuList[j]==num) {
                        ans = 2;
                        break;
                    }
                }
                if(ans!=3){
                    break;
                }
            }
        }
        Console.WriteLine(ans);
    }

    private List<int> SankakuList;

    private List<int> GetSankakuList (int max) {
        List<int> ret = new List<int>();
        for (int i = 1; i <= max; i++) {
            int num = i * (i + 1) / 2;
            if(num>max) {
                break;
            }
            ret.Add(num);
        }
        return ret;
    }
  

    public class Reader
    {
        private static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"



12




";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}
0