結果

問題 No.1274 楽しい格子点
ユーザー kotatsugame
提出日時 2020-11-07 22:17:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 368 bytes
コンパイル時間 563 ms
コンパイル使用メモリ 71,172 KB
実行使用メモリ 13,884 KB
最終ジャッジ日時 2024-07-22 14:52:50
合計ジャッジ時間 5,071 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 45 WA * 6 TLE * 1 -- * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
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=0;
	for(int i=2;;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