Submission
Status:
PPPP--PPPPPP---PPPPP
Subtask/Task Score:
75/100
Score: 75
User: sakurajima
Problemset: มุมขวาบน
Language: cpp
Time: 0.002 second
Submitted On: 2026-09-28 17:06:52
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long n;
cin >> n;
long long current = 6;
long long diff = 13;
while (current <= n) {
if (current == n) {
cout << "Cannot find top-right corner.";
return 0;
}
current += diff;
diff += 8;
}
long long i = 1;
long long latest_i = 1;
while (i * i <= n) {
latest_i = i;
i += 2;
}
long long top_right = (latest_i * latest_i) - (latest_i - 1);
cout << top_right;
}