No Rules Rules

Speed Limit (feat. 백준, 4635번) 본문

생활/코테

Speed Limit (feat. 백준, 4635번)

개발하는 완두콩 2022. 9. 8. 16:44
728x90
반응형

Speed Limit
https://www.acmicpc.net/problem/4635

 

4635번: Speed Limit

The input consists of one or more data sets. Each set starts with a line containing an integer n, 1 ≤ n ≤ 10,  followed by n pairs of values, one pair per line. The first value in a pair, s, is the speed in miles per hour and the second value, t, is t

www.acmicpc.net

 

반응형

 

// woohyeon.kim
// kim519620.tistory.com
#include <iostream>
using namespace std;
int main(){
    ios::sync_with_stdio(false), cin.tie(NULL);
    register int N, S, T;
    while(1){
        cin >> N;
        if(N == -1)
            break;
        register int ans = 0, t = 0;
        for(register int n = 0; n < N; ++n){
            cin >> S >> T;
            ans += S * (T - t);
            t = T;
        }
        cout << ans << " miles\n";
    }
    return 0;
}
// *&)*@*

 

 

아래 "Speed Limit" 와 동일한 문제입니다.

 

14541번: Speed Limit

The input consists of one or more data sets. Each set starts with a line containing an integer n, (1 ≤ n ≤ 10), followed by n pairs of values, one pair per line. The first value in a pair, s, is the speed in miles per hour and the second value, t, is t

www.acmicpc.net

 

 

728x90
반응형
Comments