Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: helloskibidi
Problemset: มุมขวาบน
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-06 09:37:02
#include <bits/stdc++.h>
using namespace std;
int main(){
int n ;
long long k=0;
cin >> n;
if(n==1) { cout << 1 ; return 0;}
while(4*k*k + 2*k + 1 <= n && n != 4*k*k + 2*k-1) k++;
if(n == 4*k*k + 2*k-1) cout << "Cannot find top-right corner.";
else if(n==4*k*k + 2*k) cout << 4*k*k + 2*k;
else if(n<4*k*k + 2*k + 1){k-- ; cout << 4*k*k + 2*k + 1;}
}