Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: modx9572

Problemset: มุมขวาบน

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-08 11:11:18

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	int ans;
	int i=1;
	while(n>pow(i,2)-(i-1)){
		ans=pow(i,2)-(i-1);
		i+=2;
	}
 	ans=pow(i,2)-(i-1);
	if(ans-2==n){
		cout<<"Cannot find top-right corner.";
		return 0;
	}
	ans=pow(i-2,2)-(i-3);
	cout << ans;
}