Submission

Status:
[P][P][P][P][P][P][P][P][PP][P]

Score: 100

User: GUGUGGUGUG

Problemset: กองส้ม

Language: cpp

Time: 0.002 second

Submitted On: 2025-03-27 18:03:48

#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll maxn = 105;
const ll inf = 1e18;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll L, n;
    cin >> L >> n;
    ll ind = 1;
    while (n - (ind * ind) >= 0) {
        n -= (ind * ind);
        ind++;
    }
    ind--;
    cout << L - ind;
    return 0;
}