Submission
Status:
--------------------
Subtask/Task Score:
0/100
Score: 0
User: Buktep
Problemset: มุมขวาบน
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-02 12:55:35
#include<bits/stdc++.h>
using namespace std;
#define int long long
int check(int k)
{
if (k < 0) return 0;
return 4 * k * k + 2 * k + 1;
}
int32_t main()
{
cin.tie(0);
ios::sync_with_stdio(0);
int n;
int s = ceil(sqrt((double)n));
s += (s%2==0);
int k = (s - 1) / 2;
int tr_k = check(k);
if (n == tr_k - 1) cout << "Cannot find top-right corner.\n";
else if (n >= tr_k) cout << tr_k << "\n";
return 0;
}