알고리즘

[알고리즘] 백준 9550 - 아이들은 사탕을 좋아해 (C++)

blueberrysoda 2024. 12. 17. 23:57

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

#include <iostream>
using namespace std;

int main(){	
    int T, N, M, inp, Cnt;
    cin >> T;

    for(int i=0; i<T; i++){
        cin >> N >> M;
        Cnt = 0;
        for(int j=0; j<N; j++){
            cin >> inp;
            while(inp >= M){
                Cnt++;
                inp -= M;
            }
        }
        cout << Cnt << "\n";
    }
    return 0;
}