Submission #61809843
Source Code Expand
Copy
#include <bits/stdc++.h>using namespace std;#define int long longsigned main() {int n; cin >> n;int x_pos = n+5;int ans = 0;long long val = n*n;for (int i = 0; i < n+5; i++) {//so this means it is at pos 0while ((x_pos+0.5)*(x_pos+0.5)+(i+0.5)*(i+0.5) > val and x_pos >= 0) x_pos--;if (x_pos < 0) break;if (i == 0) ans -= (2*x_pos+1);ans += (2*x_pos+1)*2;}cout << ans;}
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n; cin >> n; int x_pos = n+5; int ans = 0; long long val = n*n; for (int i = 0; i < n+5; i++) { //so this means it is at pos 0 while ((x_pos+0.5)*(x_pos+0.5)+(i+0.5)*(i+0.5) > val and x_pos >= 0) x_pos--; if (x_pos < 0) break; if (i == 0) ans -= (2*x_pos+1); ans += (2*x_pos+1)*2; } cout << ans; }
Submission Info
Submission Time | |
---|---|
Task | D - Squares in Circle |
User | YSH2020 |
Language | C++ 20 (gcc 12.2) |
Score | 400 |
Code Size | 469 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 3676 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 | 3612 KB |
00_sample_01.txt | AC | 1 ms | 3452 KB |
00_sample_02.txt | AC | 1 ms | 3416 KB |
01_random_00.txt | AC | 2 ms | 3472 KB |
01_random_01.txt | AC | 3 ms | 3676 KB |
01_random_02.txt | AC | 2 ms | 3496 KB |
01_random_03.txt | AC | 3 ms | 3612 KB |
01_random_04.txt | AC | 2 ms | 3536 KB |
01_random_05.txt | AC | 2 ms | 3472 KB |
01_random_06.txt | AC | 3 ms | 3540 KB |
01_random_07.txt | AC | 1 ms | 3412 KB |
01_random_08.txt | AC | 2 ms | 3536 KB |
01_random_09.txt | AC | 1 ms | 3468 KB |
01_random_10.txt | AC | 3 ms | 3448 KB |
01_random_11.txt | AC | 3 ms | 3676 KB |
01_random_12.txt | AC | 3 ms | 3528 KB |
01_random_13.txt | AC | 3 ms | 3484 KB |
01_random_14.txt | AC | 3 ms | 3532 KB |
01_random_15.txt | AC | 3 ms | 3672 KB |
01_random_16.txt | AC | 3 ms | 3612 KB |
01_random_17.txt | AC | 3 ms | 3528 KB |
01_random_18.txt | AC | 3 ms | 3488 KB |
01_random_19.txt | AC | 3 ms | 3480 KB |
01_random_20.txt | AC | 1 ms | 3492 KB |
01_random_21.txt | AC | 3 ms | 3484 KB |