Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Chayatoeyy

Problemset: มุมขวาบน

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-07 13:30:21

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long n;
    cin>>n;
    long long now = 1;
    long long ans=1;
    while(1){
        long long add = now*4 +2;
        if(ans+add>n) break;
        now+=2;
        ans+=add;
    }
    if(n==ans+now*4) cout << "Cannot find top-right corner.";
    else if(n==ans+now*4+1) cout << ans+now*4+1;
    else cout << ans;
    return 0;
}