【題解】Zerojudge e969 - 3. 大吃大喝 (Big eater)

#include <stdio.h>
#include <stdlib.h>

int money, minute, start;

int cost[2]={32, 55};

int main(void) {
	scanf("%d%d%d", &money, &minute, &start);
	int time_pass=0;
	if(money<cost[start]) {
		printf("Wayne can't eat and drink.\n");
	}
	while(money>=cost[start]) {
		printf("%d: Wayne ", time_pass);
		if(start==0) {
			printf("eats an Apple pie, ");
		} else {
			printf("drinks a Corn soup, ");
		}
		money-=cost[start];
		if(money==0) {
			printf("and now he doesn't have money.\n");
		} else {
			if(money==1) {
				printf("and now he has 1 dollar.\n");
			} else {
				printf("and now he has %d dollars.\n", money);
			}
		}
		start=1-start;
		time_pass+=minute;
	}
	
	return 0;
}

如果本文對您有幫助的話幫忙點擊廣告和分享吧!

© 若無特別註明,本站文章皆由 WeakMouse's Coding Blog 原創 ,轉載引用本文前請先留言告知。本文轉載請註明文章源自 WeakMouse's Coding Blog ,作者 ,並附上原文連結: 【題解】Zerojudge e969 - 3. 大吃大喝 (Big eater)

張貼留言

0 留言