Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Karatat007

Problemset: มุมขวาบน

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-07 13:35:52

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

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

    int n,m;
    cin >> n;
    m = sqrt(n);
    m = m + m%2;
    if(n > m*m+m) m += 2;
    if(m*m+m == n) cout << n;
    else if(m*m+m-1 == n) cout << "Cannot find top-right corner";
    else{
        m -= 2;
        cout << m*m+m+1;
    }
}