Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Score: 100
User: Namkhing
Problemset: มุมขวาบน
Language: cpp
Time: 0.002 second
Submitted On: 2025-04-11 16:33:10
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(nullptr)->ios_base::sync_with_stdio(false);
ll n;
cin >> n;
ll now = 1;
ll ans = 1;
while (true) {
ll add = now * 4 + 2;
if (ans + add > n) break;
ans += add;
now += 2;
}
if (n == ans + now * 4) cout << "Cannot find top-right corner.";
else if (n == ans + now * 4 + 1) cout << ans + now * 4 + 1;
else cout << ans;
}