結果
問題 |
No.1274 楽しい格子点
|
ユーザー |
![]() |
提出日時 | 2020-10-30 23:47:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 852 bytes |
コンパイル時間 | 1,873 ms |
コンパイル使用メモリ | 194,616 KB |
最終ジャッジ日時 | 2025-01-15 18:08:26 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 48 WA * 9 |
ソースコード
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; int main(){ ll a,b; cin>>a>>b; if(a<0) a=-a; if(b<0) b=-b; int g=gcd(a,b); if(a==0 && b==0) cout<<0.2500000000000<<endl; else if(a==0){ double ans=0; for(int i=1;i<100;i++){ if((i-1)%b==0) ans+=1.0/(double)pow(1+i,1+i); } cout<<fixed<<setprecision(10)<<ans<<endl; } else if(b==0){ double ans=0; for(int i=1;i<100;i++){ if((i-1)%a==0) ans+=1.0/(double)pow(i+1,i+1); } cout<<fixed<<setprecision(10)<<ans<<endl; } else{ double ans=0; for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ ans+=1.0/(double)pow(2+g*(i+j),2+g*(i+j)); } } cout<<fixed<<setprecision(10)<<ans<<endl; } return 0; }