結果
問題 | No.1274 楽しい格子点 |
ユーザー |
👑 ![]() |
提出日時 | 2020-10-30 22:45:07 |
言語 | C++17 (gcc 12.2.0 + boost 1.81.0) |
結果 |
AC
|
実行時間 | 665 ms / 2,000 ms |
コード長 | 1,369 bytes |
コンパイル時間 | 1,811 ms |
コンパイル使用メモリ | 199,992 KB |
実行使用メモリ | 4,372 KB |
最終ジャッジ日時 | 2023-07-08 22:19:56 |
合計ジャッジ時間 | 30,502 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 312 ms
4,368 KB |
testcase_01 | AC | 639 ms
4,368 KB |
testcase_02 | AC | 199 ms
4,368 KB |
testcase_03 | AC | 638 ms
4,368 KB |
testcase_04 | AC | 190 ms
4,372 KB |
testcase_05 | AC | 405 ms
4,368 KB |
testcase_06 | AC | 200 ms
4,368 KB |
testcase_07 | AC | 593 ms
4,368 KB |
testcase_08 | AC | 637 ms
4,368 KB |
testcase_09 | AC | 405 ms
4,368 KB |
testcase_10 | AC | 407 ms
4,368 KB |
testcase_11 | AC | 209 ms
4,372 KB |
testcase_12 | AC | 386 ms
4,368 KB |
testcase_13 | AC | 384 ms
4,372 KB |
testcase_14 | AC | 189 ms
4,372 KB |
testcase_15 | AC | 604 ms
4,368 KB |
testcase_16 | AC | 385 ms
4,368 KB |
testcase_17 | AC | 382 ms
4,368 KB |
testcase_18 | AC | 378 ms
4,368 KB |
testcase_19 | AC | 376 ms
4,372 KB |
testcase_20 | AC | 373 ms
4,372 KB |
testcase_21 | AC | 601 ms
4,372 KB |
testcase_22 | AC | 322 ms
4,368 KB |
testcase_23 | AC | 643 ms
4,368 KB |
testcase_24 | AC | 313 ms
4,372 KB |
testcase_25 | AC | 310 ms
4,368 KB |
testcase_26 | AC | 315 ms
4,368 KB |
testcase_27 | AC | 314 ms
4,368 KB |
testcase_28 | AC | 642 ms
4,368 KB |
testcase_29 | AC | 316 ms
4,368 KB |
testcase_30 | AC | 654 ms
4,372 KB |
testcase_31 | AC | 314 ms
4,372 KB |
testcase_32 | AC | 636 ms
4,368 KB |
testcase_33 | AC | 655 ms
4,368 KB |
testcase_34 | AC | 651 ms
4,372 KB |
testcase_35 | AC | 643 ms
4,368 KB |
testcase_36 | AC | 645 ms
4,368 KB |
testcase_37 | AC | 642 ms
4,368 KB |
testcase_38 | AC | 659 ms
4,372 KB |
testcase_39 | AC | 325 ms
4,372 KB |
testcase_40 | AC | 653 ms
4,368 KB |
testcase_41 | AC | 641 ms
4,368 KB |
testcase_42 | AC | 324 ms
4,368 KB |
testcase_43 | AC | 325 ms
4,368 KB |
testcase_44 | AC | 644 ms
4,372 KB |
testcase_45 | AC | 656 ms
4,372 KB |
testcase_46 | AC | 650 ms
4,368 KB |
testcase_47 | AC | 334 ms
4,368 KB |
testcase_48 | AC | 327 ms
4,372 KB |
testcase_49 | AC | 608 ms
4,368 KB |
testcase_50 | AC | 660 ms
4,372 KB |
testcase_51 | AC | 356 ms
4,368 KB |
testcase_52 | AC | 2 ms
4,368 KB |
testcase_53 | AC | 655 ms
4,372 KB |
testcase_54 | AC | 641 ms
4,372 KB |
testcase_55 | AC | 387 ms
4,368 KB |
testcase_56 | AC | 194 ms
4,368 KB |
testcase_57 | AC | 665 ms
4,368 KB |
ソースコード
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() using ll = long long; constexpr int INF = 0x3f3f3f3f; constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr double EPS = 1e-8; constexpr int MOD = 1000000007; // constexpr int MOD = 998244353; constexpr int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; constexpr int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1}; template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; } template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; } struct IOSetup { IOSetup() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); } } iosetup; int main() { ll a, b; cin >> a >> b; if (a == 0 && b == 0) { cout << 0.25 << '\n'; return 0; } if (a < 0) a = -a; if (b < 0) b = -b; ll g = gcd(a, b); long double ans = 0; if ((a / g + b / g) % 2 == 0) { REP(x, 1000) for (int y = x & 1; y < 1000; y += 2) ans += 1 / powl(1.0L * g * (x + y) + 2, 1.0L * g * (x + y) + 2); } else { REP(x, 1000) REP(y, 1000) ans += 1 / powl(1.0L * g * (x + y) + 2, 1.0L * g * (x + y) + 2); } cout << ans << '\n'; return 0; }