사과담기게임

· Algorithm
문제 상근이는 오락실에서 바구니를 옮기는 오래된 게임을 한다. 스크린은 N칸으로 나누어져 있다. 스크린의 아래쪽에는 M칸을 차지하는 바구니가 있다. (M>N>>M; basket.first = 1; basket.second = M; int ans = 0; int j; cin>>j; int fruit; while(j--) { cin>>fruit; if(fruit >= basket.first && fruit basket.second) { ans += (fruit - basket.second); basket.second = fruit; basket.first = fruit - M + 1; } } cout
따봉치치
'사과담기게임' 태그의 글 목록