結果

問題 No.820 Power of Two
ユーザー nohopennohopen
提出日時 2019-06-28 22:15:56
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 2,355 ms
コンパイル使用メモリ 102,276 KB
実行使用メモリ 26,340 KB
最終ジャッジ日時 2023-09-14 22:06:36
合計ジャッジ時間 3,845 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
24,292 KB
testcase_01 AC 64 ms
24,408 KB
testcase_02 AC 69 ms
24,116 KB
testcase_03 AC 68 ms
22,004 KB
testcase_04 AC 69 ms
23,900 KB
testcase_05 AC 70 ms
26,340 KB
testcase_06 AC 71 ms
24,344 KB
testcase_07 AC 69 ms
24,348 KB
testcase_08 AC 68 ms
24,204 KB
testcase_09 AC 68 ms
24,300 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.Linq;

class Sample {
  static void Main(string[] args) {
    int[] N = Console.ReadLine().Trim()
                                .Split(' ')
                                .Select(int.Parse)
                                .ToArray();
    double count = 0;
    var n = Math.Pow(2, N[1]);
    if (N[1] == 0) {
      count = Math.Pow(2, N[0]);
    } else {
      for (var i = n; i <= Math.Pow(2, N[0]); i+=n) {
        count += 1;
      }
    }
    Console.WriteLine(count);
  }
}
0