poj2017

    技术2024-11-20  30

    #include "stdafx.h"#include <stdio.h>

    int main(int argc, char* argv[]){  int n; int i; int speed,time; int miles; int prev=0; scanf("%d",&n); while(n != -1) {   miles = 0;  prev = 0;  for(i=0;i<n;i++)  {   scanf("%d %d",&speed,&time);   miles += speed * (time-prev);   prev = time;  }  printf("%d miles/n",miles);  scanf("%d",&n); }

     return 0;}

     

    最新回复(0)