Submission

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

Score: 100

User: ShynyC

Problemset: กองส้ม

Language: cpp

Time: 0.002 second

Submitted On: 2025-03-31 23:33:30

#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

int main(){
    int length,sales,total = 0,layers = 0;
    cin >> length >> sales;
    for(int i = 1; i <= length; i++){
        total = total + pow(i,2);
    }
    for(int i = 1; i <= length; i++){
        if(pow(i,2) <= sales){
            sales = sales - pow(i,2);
            layers++;
        }
    }
    cout << length - layers;
}