QOJ.ac
QOJ
ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#1198 | #762431 | #8027. Sky Garden | xbw_________ | xbw_________ | Failed. | 2024-11-19 14:59:32 | 2024-11-19 14:59:32 |
Details
Extra Test:
Accepted
time: 0ms
memory: 3892kb
input:
2 2
output:
79.415926535897938
result:
ok found '79.4159265', expected '79.4159265', error '0.0000000'
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#762431 | #8027. Sky Garden | xbw_________ | AC ✓ | 0ms | 4024kb | C++14 | 755b | 2024-11-19 14:57:23 | 2024-11-19 14:57:27 |
answer
#include <bits/stdc++.h>
using namespace std;
typedef double ll;
double n, m;
const ll mod = 998244353;
const double pi = 3.14159265358979323846;
ll res1 = 0, res2 = 0;
void solve() {
cin >> n >> m;
res2 += n * (n + 1) * (2 * n + 1) / 3.0;
res2 -= n * (n + 1) * (n + 1) / 2.0;
res2 = res2 * 4 * m * m + n * (n + 1) * m;
int t = (int)(floor(2 * m / pi)), s1 = t * (t + 1), s2 = (m - t) * 4 * m - 2 * m;
ll f = n * n * (n + 1) - n * (n + 1) * (2 * n + 1) / 3.0 + n * (n + 1) / 2.0;
res1 += s1 * f, res2 += s2 * f;
if (m == 1) res2 -= n * (n + 1);
printf("%.15lf", res1 * pi + res2);
}
#define mika(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)
int main() { int CYaRon = 1; while (CYaRon--) solve(); return 0; }