Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: sakuragichan

Problemset: มุมขวาบน

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-10 20:08:34

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

int main() {
    int n,i = 0,x,y;
    cin >> n;
    while (true) {
        x = (2*i)*(2*i+1)+1;
        int a = i + 1;
        y = x - (2*i);
        if (n == (2*a)*(2*a+1)+1 - 2) {
            cout << "Cannot find top-right corner.";
            break;
        }
        else if (x <= n and n < (2*a)*(2*a+1)+1) {
            cout << x;
            break;
        }
        else {
            ++i;
        }
    }
    return 0;
}