알고리즘

[알고리즘] 백준 10419 - 지각 (C++)

blueberrysoda 2025. 2. 23. 23:52

[문제 링크] : https://www.acmicpc.net/problem/10419

#include <iostream> 
using namespace std;

int main(){
    int T, tmp, Ans = 0;
    cin >> T;

    for(int i=0; i<T; i++){
        cin >> tmp;
        for(int j=0; j*j+j<=tmp; j++){
            if(j > Ans){
                Ans = j;
            }
        }
        cout << Ans << "\n";
        Ans = 0;
    }
    return 0;
}