結果

問題 No.3042 拡大コピー
ユーザー Today03
提出日時 2025-03-01 19:50:26
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 739 bytes
コンパイル時間 3,391 ms
コンパイル使用メモリ 277,392 KB
実行使用メモリ 18,020 KB
最終ジャッジ日時 2025-03-01 19:50:32
合計ジャッジ時間 4,868 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:17: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘long double’ [-Wformat=]
   26 |     printf("%.10f\n", solve(B) / solve(A));
      |             ~~~~^     ~~~~~~~~~~~~~~~~~~~
      |                 |              |
      |                 double         long double
      |             %.10Lf

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 10;
const ll INFL = 4e18;

long double solve(vector<pair<ll, ll>> A) {
    int N = A.size();
    long double gx = 0, gy = 0;
    for (int i = 0; i < N; i++) gx += A[i].first, gy += A[i].second;
    gx /= N, gy /= N;
    long double res = 0;
    for (int i = 0; i < N; i++) {
        long double val = hypot(A[i].first - gx, A[i].second - gy);
        res = max(res, val);
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    vector<pair<ll, ll>> A(N), B(N);
    for (int i = 0; i < N; i++) cin >> A[i].first >> A[i].second;
    for (int i = 0; i < N; i++) cin >> B[i].first >> B[i].second;
    printf("%.10f\n", solve(B) / solve(A));
}
0