NYOJ 125 盗梦空间

原题链接

盗梦空间这个电影我看了三遍。good!

附ac代码:

#include <stdio.h>
#include <string.h>

double cal(int t, int lev){ //接受分钟,返回秒
	double s = t;
	s *= 60;
	while(lev--)
		s /= 20;	
	return s;
}

int main(){
	int t, n, lev, temp;
	double time;
	char s[5];
	scanf("%d", &t);
	while(t-- && scanf("%d", &n)){
		lev = 0;
		time = 0;
		while(n-- && scanf("%s", s)){
			if(!strcmp(s, "IN")){
				++lev;
				continue;
			}
			if(!strcmp(s, "OUT")){
				--lev;
				continue;
			}
			scanf("%d", &temp);
			time += cal(temp, lev);			
		}
		printf("%d\n", (int)time);
	}
	return 0;
}


posted on 2014-02-12 21:43  长木Qiu  阅读(163)  评论(0编辑  收藏  举报