Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Some1258

Problemset: มุมขวาบน

Language: cpp

Time: 0.002 second

Submitted On: 2026-07-22 09:52:21

#include<bits/stdc++.h>
using namespace std;
int main(){
    int x;
    cin>>x;
    bool tell=true;
    int num=1;
    int a=1;
    while(tell){
        int temp=num+2*(2*a+1);
        if(temp>x){
            tell=false;
        }
        if(temp-1<=x){
            num=temp-1;
        }
        if(temp<=x){
            num=temp;
        }
        if(temp-2==x){
            cout<<"Cannot find top-right corner.";
            return 0;
        }
        a+=2;
    }
    cout<<num;
}