結果

問題 No.634 硬貨の枚数1
ユーザー バカらっくバカらっく
提出日時 2018-01-21 18:23:21
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,854 bytes
コンパイル時間 3,574 ms
コンパイル使用メモリ 108,404 KB
実行使用メモリ 22,908 KB
最終ジャッジ日時 2023-08-26 19:55:02
合計ジャッジ時間 12,740 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,628 KB
testcase_01 AC 55 ms
20,820 KB
testcase_02 AC 56 ms
20,612 KB
testcase_03 AC 55 ms
20,716 KB
testcase_04 AC 57 ms
22,792 KB
testcase_05 AC 56 ms
20,864 KB
testcase_06 AC 57 ms
22,720 KB
testcase_07 AC 58 ms
20,784 KB
testcase_08 AC 56 ms
20,828 KB
testcase_09 AC 56 ms
20,708 KB
testcase_10 AC 55 ms
20,596 KB
testcase_11 AC 58 ms
20,748 KB
testcase_12 AC 57 ms
20,776 KB
testcase_13 AC 55 ms
22,648 KB
testcase_14 AC 65 ms
20,792 KB
testcase_15 AC 125 ms
20,668 KB
testcase_16 AC 88 ms
22,812 KB
testcase_17 AC 92 ms
22,828 KB
testcase_18 AC 86 ms
22,756 KB
testcase_19 AC 70 ms
22,716 KB
testcase_20 AC 81 ms
22,756 KB
testcase_21 AC 134 ms
22,716 KB
testcase_22 AC 123 ms
20,664 KB
testcase_23 AC 83 ms
20,792 KB
testcase_24 AC 56 ms
20,808 KB
testcase_25 AC 57 ms
22,656 KB
testcase_26 AC 57 ms
22,708 KB
testcase_27 AC 57 ms
20,768 KB
testcase_28 AC 56 ms
20,676 KB
testcase_29 AC 57 ms
20,836 KB
testcase_30 AC 56 ms
20,796 KB
testcase_31 AC 57 ms
22,824 KB
testcase_32 AC 57 ms
20,804 KB
testcase_33 AC 56 ms
18,644 KB
testcase_34 AC 60 ms
20,856 KB
testcase_35 AC 80 ms
22,748 KB
testcase_36 AC 104 ms
20,784 KB
testcase_37 AC 89 ms
20,796 KB
testcase_38 AC 67 ms
20,752 KB
testcase_39 AC 121 ms
20,808 KB
testcase_40 AC 99 ms
20,796 KB
testcase_41 AC 98 ms
22,836 KB
testcase_42 AC 117 ms
20,736 KB
testcase_43 AC 83 ms
20,808 KB
testcase_44 AC 57 ms
18,748 KB
testcase_45 AC 57 ms
20,764 KB
testcase_46 AC 64 ms
22,828 KB
testcase_47 AC 109 ms
20,672 KB
testcase_48 AC 56 ms
18,744 KB
testcase_49 AC 58 ms
20,676 KB
testcase_50 AC 136 ms
22,784 KB
testcase_51 AC 65 ms
20,812 KB
testcase_52 WA -
testcase_53 AC 57 ms
22,652 KB
testcase_54 AC 57 ms
20,704 KB
testcase_55 AC 135 ms
20,900 KB
testcase_56 AC 134 ms
22,828 KB
testcase_57 AC 137 ms
20,868 KB
testcase_58 AC 134 ms
18,740 KB
testcase_59 AC 136 ms
22,692 KB
testcase_60 AC 133 ms
22,780 KB
testcase_61 AC 133 ms
20,772 KB
testcase_62 AC 130 ms
22,908 KB
testcase_63 AC 132 ms
20,788 KB
testcase_64 AC 135 ms
20,672 KB
testcase_65 AC 129 ms
20,632 KB
testcase_66 AC 136 ms
20,708 KB
testcase_67 AC 135 ms
22,840 KB
testcase_68 AC 132 ms
18,776 KB
testcase_69 AC 136 ms
20,704 KB
testcase_70 AC 133 ms
20,672 KB
testcase_71 AC 134 ms
20,824 KB
testcase_72 AC 134 ms
22,824 KB
testcase_73 AC 131 ms
20,740 KB
testcase_74 AC 132 ms
18,672 KB
testcase_75 AC 132 ms
20,880 KB
testcase_76 AC 57 ms
20,784 KB
testcase_77 AC 55 ms
18,732 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 + 1; 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 = @"



15415




";
    }

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