Submission #7066333


Source Code Expand

#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(double x){
  printf("%.15f",x);
}
int N;
int A[100];
int main(){
  double res=0;
  int i;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  for(i=0;i<(N);i++){
    res += 1.0 / A[i];
  }
  res = 1.0 / res;
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190820-1

// --- original code ---
// int N, A[100];
// {
//   double res = 0;
//   rd(N,A(N));
//   rep(i,N) res += 1.0 / A[i];
//   res = 1.0 / res;
//   wt(res);
// }

Submission Info

Submission Time
Task B - Resistors in Parallel
User LayCurse
Language C++14 (GCC 5.4.1)
Score 200
Code Size 1024 Byte
Status AC
Exec Time 1 ms
Memory 256 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 10
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10
Case Name Status Exec Time Memory
a01 AC 1 ms 256 KiB
a02 AC 1 ms 256 KiB
a03 AC 1 ms 256 KiB
b04 AC 1 ms 256 KiB
b05 AC 1 ms 256 KiB
b06 AC 1 ms 256 KiB
b07 AC 1 ms 256 KiB
b08 AC 1 ms 256 KiB
b09 AC 1 ms 256 KiB
b10 AC 1 ms 256 KiB