CODE FESTIVAL 2014 Hard

Submission #1034468

Source codeソースコード

#include <cstdio>
#include <cmath>

int main() {
  double p;
  long long int n;
  scanf("%lf %lld", &p, &n);
  if (p ==0.0) {
    printf("0\n");
    return 0;
  }
  if (p ==1.0) {
    if (n % 2 ==0) {
      printf("0\n");
    } else {
      printf("1\n");
    }
    return 0;
  }
  printf("%.10f\n", 0.5 * (1 - pow(1 - 2*p, n)));
  return 0;
}

Submission

Task問題 A - eject
User nameユーザ名 mu
Created time投稿日時
Language言語 C++11 (GCC 4.8.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 364 Byte
File nameファイル名
Exec time実行時間 20 ms
Memory usageメモリ使用量 1184 KB

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:7:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lf %lld", &p, &n);
^

Test case

Set

Set name Score得点 / Max score Cases
All 100 / 100 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00-sample-00 AC 18 ms 792 KB
00-sample-01 AC 18 ms 696 KB
10-random_small-00 AC 19 ms 732 KB
10-random_small-01 AC 17 ms 796 KB
10-random_small-02 AC 19 ms 928 KB
10-random_small-03 AC 18 ms 796 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 796 KB
10-random_small-07 AC 18 ms 800 KB
10-random_small-08 AC 17 ms 920 KB
10-random_small-09 AC 18 ms 924 KB
20-random_large-00 AC 20 ms 928 KB
20-random_large-01 AC 17 ms 928 KB
20-random_large-02 AC 18 ms 924 KB
20-random_large-03 AC 20 ms 1056 KB
20-random_large-04 AC 19 ms 924 KB
20-random_large-05 AC 19 ms 920 KB
20-random_large-06 AC 20 ms 924 KB
20-random_large-07 AC 18 ms 1056 KB
20-random_large-08 AC 18 ms 928 KB
20-random_large-09 AC 19 ms 1184 KB
30-p_zero-00 AC 17 ms 696 KB
30-p_zero-01 AC 18 ms 796 KB
30-p_zero-02 AC 18 ms 796 KB
30-p_zero-03 AC 18 ms 664 KB
30-p_zero-04 AC 16 ms 712 KB
40-p_one-00 AC 18 ms 672 KB
40-p_one-01 AC 18 ms 700 KB
40-p_one-02 AC 18 ms 672 KB
40-p_one-03 AC 18 ms 700 KB
40-p_one-04 AC 16 ms 692 KB
90-handmade-00 AC 17 ms 692 KB