Submission
Status:
----------
Subtask/Task Score:
0/100
Score: 0
User: Bestzu
Problemset: เลขดวง
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-15 11:01:35
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int n; cin >> n;
int i = sqrt(n);
if(i % 2 == 0) i--;
int topright = i*i - (i-1);
int topright2 = (i+2)*(i+2) - (i+1);
// cout << "topright2 = " << topright2 << endl;
if(n+2 == topright2) {
cout << "Cannot find top-right corner.";
}
else {
cout << topright << endl;
}
return 0;
}