poj2017

简单题

#include <cstdio>

int table_len;
int total_miles;

int main()
{
    while (scanf("%d", &table_len), ~table_len)
    {
        int speed, now_time, last_time = 0;
        total_miles = 0;
        for (int i = 0; i < table_len; i++)
        {
            scanf("%d%d", &speed, &now_time);
            total_miles += (now_time - last_time) * speed;
            last_time = now_time;
        }
        printf("%d miles\n", total_miles);
    }
    return 0;
}
View Code

 

posted @ 2013-06-12 19:20  金海峰  阅读(147)  评论(0编辑  收藏  举报