Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Score: 100
User: Monasm
Problemset: มุมขวาบน
Language: cpp
Time: 0.003 second
Submitted On: 2024-11-30 04:57:51
#include <bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main(){
int n,curr=0,ans=1;cin>>n;
int x = 1;
while(curr<=n){
if(x>n-curr)x--;
curr+=x;
if(n==curr-1){
cout<<"Cannot find top-right corner.";
return 0;
}
if(curr>n)break;
ans=curr;
curr+=(x*3);
x+=2;
}
cout<<ans;
}