Submission #61824954
Source Code Expand
Copy
#include<bits/stdc++.h>#define int long long#define For(i, a, b) for(int i = (a); i <= (b); i++)#define Rof(i, a, b) for(int i = (a); i >= (b); i--)using namespace std;const int N = 5e5 + 5;int n, ans;void Solve(){cin >> n;For(i, 1, n - 1) ans += floor(sqrt(n * n - pow(1.0 * i + 0.5, 2)) - 0.5);ans = ans * 4 + 4 * n - 3;cout << ans << '\n';}signed main(){cin.tie(0)->sync_with_stdio(0);int T = 1; //cin >> T;while(T--) Solve();return 0;}
#include<bits/stdc++.h> #define int long long #define For(i, a, b) for(int i = (a); i <= (b); i++) #define Rof(i, a, b) for(int i = (a); i >= (b); i--) using namespace std; const int N = 5e5 + 5; int n, ans; void Solve(){ cin >> n; For(i, 1, n - 1) ans += floor(sqrt(n * n - pow(1.0 * i + 0.5, 2)) - 0.5); ans = ans * 4 + 4 * n - 3; cout << ans << '\n'; } signed main(){ cin.tie(0)->sync_with_stdio(0); int T = 1; //cin >> T; while(T--) Solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Squares in Circle |
User | Anyees |
Language | C++ 20 (gcc 12.2) |
Score | 400 |
Code Size | 483 Byte |
Status | AC |
Exec Time | 6 ms |
Memory | 3588 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 1 ms | 3464 KB |
00_sample_01.txt | AC | 1 ms | 3448 KB |
00_sample_02.txt | AC | 1 ms | 3464 KB |
01_random_00.txt | AC | 2 ms | 3516 KB |
01_random_01.txt | AC | 6 ms | 3388 KB |
01_random_02.txt | AC | 3 ms | 3388 KB |
01_random_03.txt | AC | 6 ms | 3524 KB |
01_random_04.txt | AC | 4 ms | 3520 KB |
01_random_05.txt | AC | 4 ms | 3448 KB |
01_random_06.txt | AC | 6 ms | 3356 KB |
01_random_07.txt | AC | 2 ms | 3428 KB |
01_random_08.txt | AC | 5 ms | 3524 KB |
01_random_09.txt | AC | 1 ms | 3444 KB |
01_random_10.txt | AC | 6 ms | 3388 KB |
01_random_11.txt | AC | 6 ms | 3584 KB |
01_random_12.txt | AC | 6 ms | 3420 KB |
01_random_13.txt | AC | 6 ms | 3452 KB |
01_random_14.txt | AC | 6 ms | 3588 KB |
01_random_15.txt | AC | 6 ms | 3460 KB |
01_random_16.txt | AC | 6 ms | 3516 KB |
01_random_17.txt | AC | 6 ms | 3524 KB |
01_random_18.txt | AC | 6 ms | 3516 KB |
01_random_19.txt | AC | 6 ms | 3496 KB |
01_random_20.txt | AC | 1 ms | 3416 KB |
01_random_21.txt | AC | 6 ms | 3516 KB |