結果

問題 No.1274 楽しい格子点
ユーザー kotatsugame
提出日時 2020-11-07 22:20:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 392 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 70,124 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-22 14:52:56
合計ジャッジ時間 1,792 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 50 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<cstdio>
using namespace std;
long A,B;
long gcd(long a,long b){return b?gcd(b,a%b):a;}
main()
{
	cin>>A>>B;
	long g=gcd(A,B);
	if(g<0)g=-g;
	double ans=1./4;
	if(g)
	{
		for(int i=3;;i++)
		{
			long u=2+g*(i-2);
			if(u>20)break;
			double now=i-1;
			for(int j=0;j<u;j++)now/=u;
			ans+=now;
		}
	}
	cout<<fixed<<setprecision(16)<<ans<<endl;
}
0