結果

問題 No.144 エラトステネスのざる
ユーザー mbanmban
提出日時 2016-12-23 19:15:12
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 771 bytes
コンパイル時間 2,112 ms
コンパイル使用メモリ 106,052 KB
実行使用メモリ 25,704 KB
最終ジャッジ日時 2023-08-21 07:37:21
合計ジャッジ時間 4,697 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
23,448 KB
testcase_01 AC 68 ms
23,280 KB
testcase_02 AC 66 ms
23,344 KB
testcase_03 AC 66 ms
21,244 KB
testcase_04 AC 66 ms
23,472 KB
testcase_05 AC 66 ms
23,416 KB
testcase_06 AC 66 ms
23,436 KB
testcase_07 AC 66 ms
25,624 KB
testcase_08 AC 67 ms
25,704 KB
testcase_09 AC 65 ms
23,596 KB
testcase_10 AC 67 ms
21,636 KB
testcase_11 AC 65 ms
23,480 KB
testcase_12 AC 67 ms
25,436 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Magatro
{
    const int MAX = 100000;
    static int N;
    static double p;
    static int[] D = new int[MAX+1];
    static void Main()
    {       
        for (int i = 2; i <= MAX; i++) for (int j = i + i; j <= MAX; j += i) D[j]++;
        string[] S = Console.ReadLine().Split(' ');
        N = int.Parse(S[0]);
         p = double.Parse(S[1]);
        double ans = 0;
        for(int i = 2; i <= N; i++)
        {
            ans += P(i);
        }
        Console.WriteLine(ans);

    }
    static double P(int i)
    {
        return Math.Pow(1.0 - p, D[i]);
    }

}

0