⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p1963_模拟.cpp

📁 高手写的所有acm例程 在acm.zju.edu.cn 上的题目的例程
💻 CPP
字号:
#include<stdio.h>
#include<string.h>
char str[9];
int main()
{
//	freopen("a.txt","r",stdin);
	int n,num;
	double x;
	scanf("%d%lf",&n,&x);
	while(scanf("%d",&num)!=EOF){
		int ok=1,hh,mm,ss;
		int time=0;
		for(int i=0;i<n;i++){
			scanf("%s",str);
			if(ok){
				if(!strcmp(str,"-:--:--")) ok=0;
				else{
					sscanf(str,"%d:%d:%d",&hh,&mm,&ss);
					time+=(hh*3600+mm*60+ss);
				}
			}
		}
		printf("%3d: ",num);
		if(ok){
			time=(int)(time/x+0.5);
			mm=time/60,ss=time%60;
			printf("%d:%02d min/km\n",mm,ss);
		}
		else puts("-");
	}
	return 0;
}
//1619461 2006-02-06 10:31:45 Accepted 1963 C++ 00:00.01 392K ZojMj 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -