Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: cheetah

Problemset: มุมขวาบน

Language: cpp

Time: 0.003 second

Submitted On: 2026-06-04 21:32:23

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

int main() {
    long long n;
    cin >> n;

    long long m = 0, ans = 1, x = 1;

    while (ans < n) {
        x = ans;
        m++;
        ans = (2 * m + 1) * (2 * m + 1) - 2 * m;
    }

    if (n == ans - 2) {
        cout << "Cannot find top-right corner.";
    }
    else if (ans > n) {
        cout << x;
    }
    else {
        cout << ans;
    }

    return 0;
}