Submission

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

Score: 100

User: qwerty

Problemset: กองส้ม

Language: cpp

Time: 0.003 second

Submitted On: 2025-04-12 15:40:31

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

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int l, n;
    cin >> l >> n;
    int c = 0, i = 1;
    while (n>0) {
        n-=i*i;
        // cout << n << "\n";
        i++;
        if (n>=0) c++;
    }

    cout << min(l-c, l);
    // cout << c;
}