QOJ.ac

QOJ

IDSubmission IDProblemHackerOwnerResultSubmit timeJudge time
#1198#762431#8027. Sky Gardenxbw_________xbw_________Failed.2024-11-19 14:59:322024-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'

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#762431#8027. Sky Gardenxbw_________AC ✓0ms4024kbC++14755b2024-11-19 14:57:232024-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; }