結果

問題 No.3042 拡大コピー
ユーザー Carpenters-Cat
提出日時 2025-02-28 22:29:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 289 ms / 2,000 ms
コード長 502 bytes
コンパイル時間 1,848 ms
コンパイル使用メモリ 197,580 KB
実行使用メモリ 7,168 KB
最終ジャッジ日時 2025-03-01 07:39:22
合計ジャッジ時間 3,644 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf(" %d", &N);
      |         ~~~~~^~~~~~~~~~~
main.cpp:9:45: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |                 for (auto& [a, b] : X) scanf(" %lf %lf", &a, &b);
      |                                        ~~~~~^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main () {
	int N;
	scanf(" %d", &N);
	double sc[2];
	std::vector<pair<double, double>> X(N);
	for (int pkj = 0; pkj < 2; pkj ++) {
		for (auto& [a, b] : X) scanf(" %lf %lf", &a, &b);
		double x = 0.0, y = 0.0;
		for (auto& [a, b] : X) {
			x += a; y += b;
		}
		x/= N; y /= N;
		sc[pkj] = 0;
		for (auto& [a, b] : X) {
			double dx = a - x, dy = b - y;
			sc[pkj] += sqrt(dx * dx + dy * dy);
		}
	}
	cout << setprecision(20) << sc[1] / sc[0] << endl;
}
0