poj 2017 Speed Limit

来源:互联网 发布:php http get请求 编辑:程序博客网 时间:2024/04/30 23:37
#include "iostream"using namespace std;int main(){    int num, i, s, t, temp, ans;    while (cin >> num && num != -1)    {          temp = ans = 0;          for (i = 0; i < num; i++)          {              cin >> s >> t;              ans += s * (t - temp);              temp = t;          }          cout << ans << " miles" << endl;    }        system("pause");}

原创粉丝点击