結果

問題 No.1274 楽しい格子点
ユーザー furafura
提出日時 2020-10-30 22:10:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 1,866 ms
コンパイル使用メモリ 193,580 KB
最終ジャッジ日時 2025-01-15 17:22:30
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 50 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         lint a,b; scanf("%lld%lld",&a,&b);
      |                   ~~~~~^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int main(){
	lint a,b; scanf("%lld%lld",&a,&b);

	if(a<0) a*=-1;
	if(b<0) b*=-1;

	if(a==0 && b==0){
		puts("0.25");
		return 0;
	}


	long double g=gcd(a,b);

	long double ans=0;
	rep(i,20) rep(j,20) {
		auto x=1+i*g;
		auto y=1+j*g;
		ans+=1.0/pow(x+y,x+y);
	}
	printf("%.15Lf\n",ans);

	return 0;
}
0