Submission #6942882


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main()
{
  double R, N, M;
  cin >> R >> N >> M;
 
  double ret = 0;
 
  double One = 2 * R / N;
  rep1(i,N+M) {
    double h1 = (i - M) * One;
    double h2 = i * One;
    ret += max(max(0.0, sqrt(2 * R * h1 - h1 * h1) * 2), max(0.0, sqrt(2 * R * h2 - h2 * h2) * 2));
  }
  cout << fixed << setprecision(10) << ret << endl;
}

Submission Info

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

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 00_example_01.txt, 00_example_02.txt, 00_example_03.txt
All 200 / 200 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 1 ms 256 KB
00_example_02.txt 1 ms 256 KB
00_example_03.txt 2 ms 256 KB
10_rand_01.txt 1 ms 256 KB
10_rand_02.txt 1 ms 256 KB
10_rand_03.txt 2 ms 256 KB
10_rand_04.txt 1 ms 256 KB
10_rand_05.txt 1 ms 256 KB
10_rand_06.txt 1 ms 256 KB
10_rand_07.txt 1 ms 256 KB
10_rand_08.txt 1 ms 256 KB
20_hand_01.txt 2 ms 256 KB
20_hand_02.txt 4 ms 256 KB
20_hand_03.txt 2 ms 256 KB
20_hand_04.txt 1 ms 256 KB
20_hand_05.txt 1 ms 256 KB