[C++] 백준 1568 새
·
Algorithm/Baekjoon
#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int num = 0, n, m = 1; cin >> n; while (n > 0) { if (n >= m)//부르려는 수가 새보다 적을 때 { n -= m;//총 새에 부르는 수 감소 num++; //카운트 m++; //부르는 수 증가 } else//총남은 새가 부르려는 수보다 적을 때 { m = 1; } } cout