Submission

Status:

PPPP--PPPPPP---PPPPP

Subtask/Task Score:

75/100

Score: 75

User: sakurajima

Problemset: มุมขวาบน

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-28 17:13:56

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    long long n;
    cin >> n;

    long long i = 1;
    long long latest_i = 1;

    while (i * i <= n) {
        latest_i = i;
        i += 2;
    }

    long long top_right = (latest_i * latest_i) - (latest_i - 1);

    latest_i += 2;
    long long next = (latest_i * latest_i) - (latest_i - 1);
    if (n == next - 2) {
        cout << "Cannot find top-right corner.";
        return 0;
    }
    
    cout << top_right;

}