NYOJ662 汽水瓶

原题链接


#include <stdio.h>

int main(){
	int n, count;
	while(scanf("%d", &n), n){
		count = 0;
		while(n > 2){
			count += n / 3;
			n = n / 3 + n % 3;
		}
		if(n == 2) ++count;
		printf("%d\n", count);
	}
	return 0;
}


posted on 2014-03-07 20:14  长木Qiu  阅读(111)  评论(0编辑  收藏  举报