Submission #7973440


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

double calc(int x){
  if(x<=0 || x>=n) return 0;
  double k=fabs(r-2*r/n*x);
  return sqrt(r*r-k*k)*2;
}

signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(12);
  double r,n,m;
  cin>>r>>n>>m;
  double ans=0;
  double one=(r*2)/n;
  rep(i,n+m){
    ans+=max(calc(i),calc(i-m));
  }
  cout<<ans<<endl;

  return 0;
}

Submission Info

Submission Time
Task B - ステップカット
User cr0p
Language C++14 (GCC 5.4.1)
Score 0
Code Size 749 Byte
Status CE

Compile Error

./Main.cpp: In function ‘double calc(long long int)’:
./Main.cpp:18:17: error: ‘n’ was not declared in this scope
   if(x<=0 || x>=n) return 0;
                 ^
./Main.cpp:19:17: error: ‘r’ was not declared in this scope
   double k=fabs(r-2*r/n*x);
                 ^
./Main.cpp:19:23: error: ‘n’ was not declared in this scope
   double k=fabs(r-2*r/n*x);
                       ^