Submission #6927776
Source Code Expand
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
ll M = 1000000007;
typedef pair<int, int> P;
bool ps1(const P &element1, const P &element2)
{ //first昇順
return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
return element1.second > element2.second;
}
int digits(int n)
{
int count = 0;
while (n > 0)
{
n /= 10;
count++;
}
return count;
}
/*int digit(int n)
{
int ans = 0;
while (n > 0)
{
ans += n % 10;
n /= 10;
}
return ans;
}*/
ll combination(ll n, ll r)
{
if (r * 2 > n)
r = n - r;
ll dividend = 1;
ll divisor = 1;
for (ll i = 1; i <= r; ++i)
{
dividend *= (n - i + 1);
divisor *= i;
}
return dividend / divisor;
}
int GCD(int x, int y)
{
return x ? GCD(y % x, x) : y;
}
vector<int> divisor(int n)
{
vector<int> value;
FOR(i, 1, pow(n, 0.5) + 1)
{
if (i <= sqrt(n))
{
if (n % i == 0)
{
value.push_back(i);
if (i * i != n)
{
value.push_back(n / i);
}
}
}
}
return value;
}
int main()
{
double r;
int n,m;
cin>>r>>n>>m;
vector<double>len(n+m);
/*if(n%2!=0){
double pin=M_PI/(n-1.0);
rep(i,n){
//cout<<(double)abs(n/2+1-i)/t*M_PI/4<<" ";
len[i]=(double) r*sin(pin*i)*2;
}
}else{
double pin=M_PI/(n-1.0);
//cout<<pin<<endl;
rep(i,n){
//cout<<i<<" ";
//cout<<(double)pin*i<<" ";
len[i]=abs((double) 2*r*sin(pin*i));
}
}
double ans=0;
rep(i,n+m){
cout<<i<<" "<<i-m<<endl;
cout<<len[i]<<endl;
if(i-m<n&& i-m>=0){
ans+=max(len[i],len[i-m]);
}else{
ans+=len[i];
}
}
cout<<ans<<endl;*/
rep(i,n){
//cout<<abs(i-n/2)<<" ";
//cout<<2*sqrt(r*r-pow((double)abs(i-n/2.00)*2/n*r,2))<<endl;
len[i]=2*sqrt(r*r-pow((double)abs(i-n/2.00)*2/n*r,2));
}
double ans=0;
rep(i,n+m){
if(i-m>=0&&i-m<n){
ans+=max(len[i],len[i-m]);
}else{
ans+=len[i];
}
}
cout<<setprecision(18)<<ans<<endl;
}
Submission Info
Submission Time |
|
Task |
B - ステップカット |
User |
hakoshie |
Language |
C++14 (GCC 5.4.1) |
Score |
200 |
Code Size |
2928 Byte |
Status |
AC |
Exec Time |
3 ms |
Memory |
1792 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
200 / 200 |
Status |
|
|
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 |
3 ms |
1024 KB |
10_rand_01.txt |
AC |
1 ms |
256 KB |
10_rand_02.txt |
AC |
1 ms |
256 KB |
10_rand_03.txt |
AC |
2 ms |
640 KB |
10_rand_04.txt |
AC |
1 ms |
256 KB |
10_rand_05.txt |
AC |
1 ms |
256 KB |
10_rand_06.txt |
AC |
1 ms |
256 KB |
10_rand_07.txt |
AC |
1 ms |
384 KB |
10_rand_08.txt |
AC |
1 ms |
384 KB |
20_hand_01.txt |
AC |
3 ms |
1024 KB |
20_hand_02.txt |
AC |
3 ms |
1792 KB |
20_hand_03.txt |
AC |
3 ms |
1024 KB |
20_hand_04.txt |
AC |
1 ms |
256 KB |
20_hand_05.txt |
AC |
1 ms |
256 KB |