Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Kidmaiok
Problemset: มุมขวาบน
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-12 03:33:21
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define space << ' '
#define nl << endl
long long topright(long long n) {
return 4 * n * n + 2 * n + 1;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int x;
cin >> x;
int n = 0,right = 0,previous = 1;
while(right < x){
previous = right;
right = topright(n);
n++;
}
if(right - x == 2){
cout << "Cannot find top-right corner.";
}else if(right - x == 1){
cout << x;
}else if(right == x){
cout << right;
}else {
cout << previous;
}
}