結果
| 問題 |
No.1274 楽しい格子点
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2020-10-30 21:54:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 724 bytes |
| コンパイル時間 | 1,552 ms |
| コンパイル使用メモリ | 168,000 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-22 00:26:35 |
| 合計ジャッジ時間 | 3,808 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 55 WA * 1 RE * 1 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
LL GCD(LL a, LL b) { return b ? GCD(b, a % b) : a; }
double F(LL x) {
return pow(1. / double(x), double(x));
}
int main() {
cout << fixed << setprecision(10);
LL A, B; cin >> A >> B;
A = abs(A); B = abs(B);
LL G = GCD(A, B);
A /= G; B /= G;
double ans = 0.;
if (A % 2 == 1 && B % 2 == 1) {
rep(x, 20) rep(y, 20) {
if (x % G != 0 || y % G != 0) continue;
if ((x + y) % 2 == 1) continue;
ans += F(x + y + 2);
}
}
else {
rep(x, 20) rep(y, 20) {
if (x % G != 0 || y % G != 0) continue;
ans += F(x + y + 2);
}
}
cout << ans << endl;
return 0;
}
Nachia