Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Patn01Z
Problemset: มุมขวาบน
Language: cpp
Time: 0.005 second
Submitted On: 2026-10-13 18:54:23
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
int top =1;
vector<int> rt;
rt.push_back(1);
int i=2;
while(rt.back()<N){
int temp=4*i*i-6*i+3;
rt.push_back(temp);
i++;
}
if(N==rt.back()-1){
cout << N;
}
else if(N==rt.back()-2){
cout << "Cannot find top-right corner.";
}
else if(N==rt.back()){
cout << N;
}
else{
cout << rt[rt.size()-2];
}
return 0;
}