結果

問題 No.3042 拡大コピー
ユーザー 沙耶花
提出日時 2025-02-28 21:43:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 294 ms / 2,000 ms
コード長 741 bytes
コンパイル時間 4,000 ms
コンパイル使用メモリ 251,964 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2025-03-01 07:38:06
合計ジャッジ時間 5,776 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |                 scanf("%lf %lf",&a[i],&b[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
main.cpp:21:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |                 scanf("%lf %lf",&c[i],&d[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000000
#define Inf64 1000000000000000001LL

int main(){
	int n;
	cin>>n;
	vector<double> a(n),b(n),c(n),d(n);
	double as = 0,bs = 0,cs = 0,ds = 0;
	rep(i,n){
		scanf("%lf %lf",&a[i],&b[i]);
		as += a[i],bs += b[i];
	}
	rep(i,n){
		scanf("%lf %lf",&c[i],&d[i]);
		cs += c[i],ds += d[i];
	}
	as /= n;
	bs /= n;
	cs /= n;
	ds /= n;
	double d0 = 0,d1 = 0;
	rep(i,n){
		d0 += sqrt((a[i]-as)*(a[i]-as)+(b[i]-bs)*(b[i]-bs));
		d1 += sqrt((c[i]-cs)*(c[i]-cs)+(d[i]-ds)*(d[i]-ds));
	}
	cout<<fixed<<setprecision(15)<<d1/d0<<endl;
	return 0;
}
0