Submission #6773243


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    long double r,n,m,ans=0;cin>>r>>n>>m;
    vector<long double> v(n+1,0);
    for(int i=1;i < n+1;i++)
    {
        long double tate=r-i*2*r/n;
        v.at(i)=2.0*sqrt(r*r-tate*tate);
    }


    for(int i=0;i-m <= n;i++)
    {
        if(0<=i-m && i<=n){
            ans+=max(v.at(i),v.at(i-m));
        }else if(n<i){
            ans+=v.at(i-m);
        }else{
            ans+=v.at(i);
        }
    }

    printf("%.10Lf\n",ans);

}

Submission Info

Submission Time
Task B - ステップカット
User Hyado
Language C++14 (GCC 5.4.1)
Score 200
Code Size 988 Byte
Status AC
Exec Time 4 ms
Memory 1792 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 16
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt, 00_example_03.txt
All 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 10_rand_06.txt, 10_rand_07.txt, 10_rand_08.txt, 20_hand_01.txt, 20_hand_02.txt, 20_hand_03.txt, 20_hand_04.txt, 20_hand_05.txt
Case Name Status Exec Time Memory
00_example_01.txt AC 1 ms 256 KB
00_example_02.txt AC 1 ms 256 KB
00_example_03.txt AC 4 ms 1792 KB
10_rand_01.txt AC 1 ms 256 KB
10_rand_02.txt AC 1 ms 256 KB
10_rand_03.txt AC 3 ms 896 KB
10_rand_04.txt AC 1 ms 256 KB
10_rand_05.txt AC 1 ms 384 KB
10_rand_06.txt AC 1 ms 256 KB
10_rand_07.txt AC 2 ms 512 KB
10_rand_08.txt AC 2 ms 384 KB
20_hand_01.txt AC 4 ms 1792 KB
20_hand_02.txt AC 4 ms 1792 KB
20_hand_03.txt AC 4 ms 1792 KB
20_hand_04.txt AC 1 ms 256 KB
20_hand_05.txt AC 1 ms 256 KB