結果

問題 No.648  お や す み 
ユーザー hayashihayashi
提出日時 2019-10-28 13:31:05
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 689 bytes
コンパイル時間 1,885 ms
コンパイル使用メモリ 99,660 KB
実行使用メモリ 24,716 KB
最終ジャッジ日時 2023-10-12 23:02:24
合計ジャッジ時間 10,188 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
20,652 KB
testcase_01 AC 52 ms
20,628 KB
testcase_02 AC 54 ms
18,592 KB
testcase_03 AC 53 ms
20,652 KB
testcase_04 AC 53 ms
20,848 KB
testcase_05 AC 54 ms
20,692 KB
testcase_06 AC 54 ms
20,696 KB
testcase_07 AC 54 ms
22,704 KB
testcase_08 AC 54 ms
22,656 KB
testcase_09 AC 54 ms
20,664 KB
testcase_10 AC 53 ms
22,724 KB
testcase_11 AC 53 ms
20,620 KB
testcase_12 AC 54 ms
20,740 KB
testcase_13 AC 54 ms
22,888 KB
testcase_14 AC 53 ms
20,680 KB
testcase_15 AC 53 ms
22,676 KB
testcase_16 AC 53 ms
20,640 KB
testcase_17 AC 53 ms
20,596 KB
testcase_18 AC 54 ms
20,636 KB
testcase_19 AC 52 ms
20,760 KB
testcase_20 AC 55 ms
20,728 KB
testcase_21 AC 55 ms
22,624 KB
testcase_22 AC 55 ms
24,716 KB
testcase_23 AC 54 ms
22,732 KB
testcase_24 AC 54 ms
22,696 KB
testcase_25 AC 54 ms
22,660 KB
testcase_26 AC 54 ms
20,720 KB
testcase_27 AC 55 ms
20,640 KB
testcase_28 AC 54 ms
20,640 KB
testcase_29 AC 55 ms
22,696 KB
testcase_30 AC 53 ms
20,656 KB
testcase_31 AC 54 ms
20,708 KB
testcase_32 AC 53 ms
20,680 KB
testcase_33 AC 54 ms
22,688 KB
testcase_34 AC 54 ms
20,736 KB
testcase_35 AC 53 ms
20,668 KB
testcase_36 AC 52 ms
20,656 KB
testcase_37 AC 52 ms
22,808 KB
testcase_38 AC 54 ms
20,656 KB
testcase_39 AC 52 ms
20,600 KB
testcase_40 AC 53 ms
20,584 KB
testcase_41 AC 53 ms
20,664 KB
testcase_42 AC 53 ms
20,740 KB
testcase_43 AC 52 ms
18,628 KB
testcase_44 AC 54 ms
20,692 KB
testcase_45 AC 54 ms
22,672 KB
testcase_46 AC 53 ms
20,716 KB
testcase_47 AC 53 ms
20,624 KB
testcase_48 AC 53 ms
20,672 KB
testcase_49 AC 54 ms
22,876 KB
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 RE -
testcase_56 RE -
testcase_57 RE -
testcase_58 RE -
testcase_59 RE -
testcase_60 RE -
testcase_61 RE -
testcase_62 RE -
testcase_63 RE -
testcase_64 RE -
testcase_65 RE -
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 RE -
testcase_71 RE -
testcase_72 RE -
testcase_73 RE -
testcase_74 RE -
testcase_75 RE -
testcase_76 RE -
testcase_77 RE -
testcase_78 RE -
testcase_79 RE -
testcase_80 RE -
testcase_81 RE -
testcase_82 AC 55 ms
20,668 KB
testcase_83 AC 55 ms
20,680 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.Generic;
using static System.Console;
namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(ReadLine());
            //等差数列
            //k(k+1)/2 = n
            //√k(k+1) = √2n
            //√k*k < √k(k+1) = √2n < √(K+1)(k+1)
            //k<√2n<k+1
            //(long)√2n → k
            long a = (long)Math.Sqrt(2 * N);
            if(a * (a + 1) / 2 == N)
            {
                WriteLine("YES");
                WriteLine(a);
            }
            else
            {
                WriteLine("NO");
            }
        }
    }
}
0