結果

問題 No.1385 Simple Geometry 2
ユーザー cardano1016cardano1016
提出日時 2021-02-07 15:36:06
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 119 ms / 500 ms
コード長 2,785 bytes
コンパイル時間 1,049 ms
コンパイル使用メモリ 106,204 KB
実行使用メモリ 11,068 KB
最終ジャッジ日時 2023-09-17 18:36:08
合計ジャッジ時間 12,606 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 116 ms
10,940 KB
testcase_14 AC 116 ms
10,804 KB
testcase_15 AC 116 ms
10,864 KB
testcase_16 AC 116 ms
10,800 KB
testcase_17 AC 116 ms
11,064 KB
testcase_18 AC 115 ms
10,852 KB
testcase_19 AC 113 ms
10,800 KB
testcase_20 AC 115 ms
10,872 KB
testcase_21 AC 115 ms
10,808 KB
testcase_22 AC 113 ms
10,864 KB
testcase_23 AC 116 ms
10,936 KB
testcase_24 AC 113 ms
10,848 KB
testcase_25 AC 112 ms
10,920 KB
testcase_26 AC 116 ms
10,948 KB
testcase_27 AC 115 ms
10,932 KB
testcase_28 AC 113 ms
10,748 KB
testcase_29 AC 116 ms
10,848 KB
testcase_30 AC 115 ms
10,752 KB
testcase_31 AC 116 ms
10,868 KB
testcase_32 AC 114 ms
10,916 KB
testcase_33 AC 115 ms
10,768 KB
testcase_34 AC 114 ms
10,984 KB
testcase_35 AC 115 ms
10,936 KB
testcase_36 AC 115 ms
11,064 KB
testcase_37 AC 115 ms
10,816 KB
testcase_38 AC 117 ms
10,752 KB
testcase_39 AC 116 ms
10,736 KB
testcase_40 AC 116 ms
10,920 KB
testcase_41 AC 115 ms
11,064 KB
testcase_42 AC 116 ms
10,852 KB
testcase_43 AC 117 ms
10,844 KB
testcase_44 AC 117 ms
10,736 KB
testcase_45 AC 119 ms
10,820 KB
testcase_46 AC 116 ms
10,796 KB
testcase_47 AC 117 ms
10,924 KB
testcase_48 AC 116 ms
10,852 KB
testcase_49 AC 118 ms
10,992 KB
testcase_50 AC 117 ms
10,732 KB
testcase_51 AC 116 ms
10,944 KB
testcase_52 AC 117 ms
10,864 KB
testcase_53 AC 116 ms
10,920 KB
testcase_54 AC 116 ms
10,896 KB
testcase_55 AC 115 ms
10,916 KB
testcase_56 AC 117 ms
10,916 KB
testcase_57 AC 115 ms
10,860 KB
testcase_58 AC 116 ms
10,736 KB
testcase_59 AC 107 ms
10,860 KB
testcase_60 AC 109 ms
10,876 KB
testcase_61 AC 109 ms
10,748 KB
testcase_62 AC 110 ms
11,068 KB
testcase_63 AC 117 ms
11,064 KB
testcase_64 AC 117 ms
10,932 KB
testcase_65 AC 116 ms
10,736 KB
testcase_66 AC 117 ms
10,920 KB
testcase_67 AC 116 ms
10,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#include <chrono>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=a;i<b;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,a) rrepi(i,a,0)
#define rrepi(i,a,b) for(ll i=a-1;i>=b;--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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 (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<int,int> pi;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<double,double> point;
typedef complex<double> Point;
typedef string::const_iterator State;
const ll MAX = 105;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};

const double PI = 3.1415926535;

int main(){
    ll n,l;
    scanf("%lld %lld",&n,&l);
    vector<double> coss(n),sins(n);
    rep(i,n){
        double t;
        scanf("%lf",&t);
        coss[i] = cos(2*PI*t/(double)l);
        sins[i] = sin(2*PI*t/(double)l);
    }
    double sumsin = 0.0,sumcos = 0.0;
    rep(i,n){
        sumsin += sins[i];
        sumcos += coss[i];
    }
    double ans = 0.0,nowsin = 0.0,nowcos = 0.0;
    rep(i,n-1){
        nowsin += (n-i-2)*sins[i+1];
        nowcos += (n-i-2)*coss[i+1];
    }
    rep(i,n){
        ans += nowsin*coss[i]-nowcos*sins[i];
        nowsin = nowsin+sumsin-(n-1)*sins[(i+1)%n]-sins[i];
        nowcos = nowcos+sumcos-(n-1)*coss[(i+1)%n]-coss[i];
    }
    ll k = n*(n-1)*(n-2)/6;
    printf("%.10lf\n",ans/(double)k/2.0);
}
0