1. 简单题


#include <iostream>
#include <cstring>
using namespace std;

int main()
{
    int n, i, ans, t[11], s;
    while (cin >> n)
    {
        if (n == -1)
            break;
        memset(t, 0, sizeof(t));
        ans = 0;
        for (i = 1; i <= n; i++)
        {
            cin >> s >> t[i];
            ans += s * (t[i] - t[i-1]);
        }
        cout << ans << " miles" << endl;
    }
    return 0;
}


相关文章:

  • 2022-12-23
  • 2021-07-07
  • 2021-07-22
  • 2021-12-05
  • 2021-12-10
  • 2021-12-07
猜你喜欢
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案