Submission #1101420


Source Code Expand

#include <cstdio>
#include <iostream>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;



int main(void){
  double p;
  ll n;
  cin >> p >> n;
  double sum = 1;
  double cur = 1 - 2 * p;
  while (n > 0) {
    if (n % 2 == 1) {
      sum *= cur;
    }
    cur *= cur;
    n /= 2;
  }
  printf("%.15f\n", 0.5 * (1 - sum));
}

Submission Info

Submission Time
Task A - eject
User kobae964
Language C++ (G++ 4.6.4)
Score 100
Code Size 377 Byte
Status AC
Exec Time 19 ms
Memory 972 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 33
Set Name Test Cases
All 00-sample-00, 00-sample-01, 10-random_small-00, 10-random_small-01, 10-random_small-02, 10-random_small-03, 10-random_small-04, 10-random_small-05, 10-random_small-06, 10-random_small-07, 10-random_small-08, 10-random_small-09, 20-random_large-00, 20-random_large-01, 20-random_large-02, 20-random_large-03, 20-random_large-04, 20-random_large-05, 20-random_large-06, 20-random_large-07, 20-random_large-08, 20-random_large-09, 30-p_zero-00, 30-p_zero-01, 30-p_zero-02, 30-p_zero-03, 30-p_zero-04, 40-p_one-00, 40-p_one-01, 40-p_one-02, 40-p_one-03, 40-p_one-04, 90-handmade-00
Case Name Status Exec Time Memory
00-sample-00 AC 19 ms 920 KB
00-sample-01 AC 18 ms 792 KB
10-random_small-00 AC 19 ms 920 KB
10-random_small-01 AC 19 ms 968 KB
10-random_small-02 AC 19 ms 920 KB
10-random_small-03 AC 18 ms 924 KB
10-random_small-04 AC 18 ms 796 KB
10-random_small-05 AC 18 ms 920 KB
10-random_small-06 AC 18 ms 972 KB
10-random_small-07 AC 18 ms 796 KB
10-random_small-08 AC 17 ms 920 KB
10-random_small-09 AC 17 ms 916 KB
20-random_large-00 AC 17 ms 796 KB
20-random_large-01 AC 17 ms 920 KB
20-random_large-02 AC 19 ms 796 KB
20-random_large-03 AC 19 ms 796 KB
20-random_large-04 AC 19 ms 796 KB
20-random_large-05 AC 18 ms 920 KB
20-random_large-06 AC 19 ms 788 KB
20-random_large-07 AC 18 ms 920 KB
20-random_large-08 AC 18 ms 792 KB
20-random_large-09 AC 18 ms 796 KB
30-p_zero-00 AC 19 ms 924 KB
30-p_zero-01 AC 18 ms 792 KB
30-p_zero-02 AC 17 ms 796 KB
30-p_zero-03 AC 19 ms 920 KB
30-p_zero-04 AC 19 ms 796 KB
40-p_one-00 AC 19 ms 792 KB
40-p_one-01 AC 18 ms 796 KB
40-p_one-02 AC 18 ms 924 KB
40-p_one-03 AC 19 ms 916 KB
40-p_one-04 AC 18 ms 796 KB
90-handmade-00 AC 18 ms 920 KB