这是哈尔滨工业大学acmOJ的源代码

源代码在线查看: 1688.cpp

软件大小: 648 K
上传用户: haowoainime
关键词: acmOJ 工业 大学 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*  This Code is Submitted by wywcgs for Problem 1688 on 2005-03-05 at 15:55:07 */ 
				#include 
				
				int main()
				{
				    int speed[10] = {0}, time[10] = {0}, distance = 0;
				    int n, i;
				    
				    while(scanf("%d", &n) == 1){
				        if(n == -1){
				            return 0;
				        }else{
				            for(i = 0; i < n; i++){
				                scanf("%d %d", &speed[i], &time[i]);
				                if(i == 0){
				                    distance = speed[0] * time[0];
				                }else{
				                    distance += speed[i] * (time[i] - time[i-1]);
				                }    
				            }
				            printf("%d miles\n", distance);
				        }
				    }
				
				    return 0;
				}			

相关资源