Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Dark_kingdom

Problemset: มุมขวาบน

Language: cpp

Time: 0.005 second

Submitted On: 2026-10-12 20:07:12

#include <iostream>
#include <cmath>
using namespace std;

long long ural(int n)
{
	for(long long i = 0; i<n; i++)
	{
		long long k = 4*pow(i,2)+2*(i) +1;
		long long l = 4*pow(i+1,2)+2*(i+1) +1;
		if(n==k-2)
		{
			return -1;
		}
		else if(n<l-2)
		{
			return k;
		}
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	long long n;
	cin>>n;
	if (ural(n) == -1)
	{
		cout<<"Cannot find top-right corner.";
	}
	else{
		cout<<ural(n);
	}
	
	
	return 0;
}