Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: samsenpisardmoo26

Problemset: มุมขวาบน

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-11 20:01:56

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    cin >> n;
    long long c=1;
    long long k=1;
    long long l=1;

    while(true)
    {
        if(c>=n) break;  
        l=c;
        c+=4*k+2;
        k+=2;
    }

    if (c-n==2) cout<<"Cannot find top-right corner.";
    else if(c == n) cout << c;
    else cout<<l;
}