結果

問題 No.1466 I am not genius.
ユーザー LayCurseLayCurse
提出日時 2021-04-02 22:05:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 4,314 bytes
コンパイル時間 2,138 ms
コンパイル使用メモリ 208,888 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-25 12:19:57
合計ジャッジ時間 3,127 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(double &x){
  int k;
  int m=0;
  int p=0;
  double r = 1;
  x = 0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m = 1;
      break;
    }
    if(k=='.'){
      p = 1;
      break;
    }
    if('0'<=k&&k<='9'){
      x = k - '0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k=='.'){
      p = 1;
      continue;
    }
    if(k<'0'||k>'9'){
      break;
    }
    if(p){
      r *= 0.1;
      x += r * (k - '0');
    }
    else{
      x = x * 10 + k - '0';
    }
  }
  if(m){
    x = -x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
int WRITER_DOUBLE_DIGIT = 15;
inline int writerDigit_double(){
  return WRITER_DOUBLE_DIGIT;
}
inline void writerDigit_double(int d){
  WRITER_DOUBLE_DIGIT = d;
}
inline void wt_L(double x){
  const int d = WRITER_DOUBLE_DIGIT;
  int k;
  int r;
  double v;
  if(x!=x || (x==x+1 && x==2*x)){
    my_putchar_unlocked('E');
    my_putchar_unlocked('r');
    my_putchar_unlocked('r');
    return;
  }
  if(x < 0){
    my_putchar_unlocked('-');
    x = -x;
  }
  x += 0.5 * pow(0.1, d);
  r = 0;
  v = 1;
  while(x >= 10*v){
    v *= 10;
    r++;
  }
  while(r >= 0){
    r--;
    k = floor(x / v);
    if(k >= 10){
      k = 9;
    }
    if(k <= -1){
      k = 0;
    }
    x -= k * v;
    v *= 0.1;
    my_putchar_unlocked(k + '0');
  }
  if(d > 0){
    my_putchar_unlocked('.');
    v = 1;
    for(r=(0);r<(d);r++){
      v *= 0.1;
      k = floor(x / v);
      if(k >= 10){
        k = 9;
      }
      if(k <= -1){
        k = 0;
      }
      x -= k * v;
      my_putchar_unlocked(k + '0');
    }
  }
}
int main(){
  int m, n;
  double a = -1;
  double b = 4;
  double c = 1123;
  double d = 21460;
  double g = 2;
  double h = 99;
  double i = 1103;
  double j = 26390;
  double k = 1;
  double l = 882;
  double f[100];
  double x;
  rd(x);
  wt_L(x * 4);
  wt_L('\n');
  return 0;
  double s1 = 0;
  double s2 = 0;
  double tmp;
  double res;
  f[0] = 1;
  for(m=(1);m<(100);m++){
    f[m] = f[m-1] * m;
  }
  for(n=(0);n<(20);n++){
    tmp = 1;
    if(n%2){
      tmp *= -1;
    }
    tmp *= 24;
    tmp *= 4*n;
    tmp *= 4*n-1;
    tmp *= 4*n-2;
    tmp *= 4*n-3;
    tmp *= (c + d*n);
    tmp /= pow(l,n+k);
    tmp /= pow(49.0/22.0*b*h,n);
    tmp /= pow(pow(2,pow(2,n))*f[n],b);
    s1 += tmp;
    tmp = 1;
    tmp *= f[4*n];
    tmp *= i + j * n;
    tmp /= pow(pow(22.0/49*l,n) * f[n], b);
    s2 += tmp;
  }
  s2 *= sqrt(pow(g,3) / pow(h,4));
  wt_L(s1);
  wt_L(' ');
  wt_L(s2);
  wt_L('\n');
  res = x * s1 / s2;
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay version 20210328-1 [beta]

// --- original code ---
// {
//   double a = -1;
//   double b = 4;
//   double c = 1123;
//   double d = 21460;
//   double g = 2;
//   double h = 99;
//   double i = 1103;
//   double j = 26390;
//   double k = 1;
//   double l = 882;
//   double f[100];
// 
//   double @x;
//   wt(x * 4);
//   return 0;
// 
//   double s1 = 0, s2 = 0, tmp, res;
// 
//   f[0] = 1;
//   rep(m,1,100) f[m] = f[m-1] * m;
// 
//   rep(n,20){
//     tmp = 1;
//     if(n%2) tmp *= -1;
//     tmp *= 24;
//     tmp *= 4*n; tmp *= 4*n-1; tmp *= 4*n-2; tmp *= 4*n-3;
//     tmp *= (c + d*n);
//     tmp /= pow(l,n+k);
//     tmp /= pow(49.0/22.0*b*h,n);
//     tmp /= pow(pow(2,pow(2,n))*f[n],b);
//     s1 += tmp;
// 
//     tmp = 1;
//     tmp *= f[4*n];
//     tmp *= i + j * n;
//     tmp /= pow(pow(22.0/49*l,n) * f[n], b);
//     s2 += tmp;
//   }
//   s2 *= sqrt(pow(g,3) / pow(h,4));
//   wt(s1,s2);
//   res = x * s1 / s2;
//   wt(res);
// }
0