提出 #11960055


ソースコード 拡げる

#include <string.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long unsigned int ll;

#define N 8

int main() {
    int n = 0;
    double x[N];
    double y[N];

    
    cin >> n;

    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
    }
    vector<int> order(n);
    for (int i = 0; i < n; i++) order[i] = i;

    double res = 0.0;
    double cnt = 0;
    do {
        double sum = 0;
        for (int i = 1; i < n; ++i) {
            double x_ = x[order[i-1]]-x[order[i]];
            double y_ = y[order[i-1]]-y[order[i]];
            double tmp = std::sqrt(x_ * x_+ y_ * y_);
            sum += tmp;
            //cout << std::fixed << tmp << endl;
        }

        res += sum;
        //cout << std::fixed << res << endl;
        cnt++;

    } while (next_permutation(order.begin(), order.end()));
    cout << std::fixed << res/cnt  << endl;

}

提出情報

提出日時
問題 C - Average Length
ユーザ rk018
言語 C++14 (GCC 5.4.1)
得点 300
コード長 997 Byte
結果 AC
実行時間 3 ms
メモリ 256 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 15
セット名 テストケース
Sample sample00, sample01, sample02
All handmade03, handmade04, handmade05, random06, random07, random08, random09, random10, random11, random12, random13, random14, sample00, sample01, sample02
ケース名 結果 実行時間 メモリ
handmade03 AC 2 ms 256 KiB
handmade04 AC 2 ms 256 KiB
handmade05 AC 3 ms 256 KiB
random06 AC 1 ms 256 KiB
random07 AC 1 ms 256 KiB
random08 AC 1 ms 256 KiB
random09 AC 1 ms 256 KiB
random10 AC 1 ms 256 KiB
random11 AC 1 ms 256 KiB
random12 AC 2 ms 256 KiB
random13 AC 2 ms 256 KiB
random14 AC 2 ms 256 KiB
sample00 AC 1 ms 256 KiB
sample01 AC 1 ms 256 KiB
sample02 AC 2 ms 256 KiB