๐Ÿ“ฆ Chango/๐Ÿš™ Softeer

[Softeer][๋ฐ๋ธŒํฌ๋ฃจ 1์ผ์ฐจ] ์†Œํ”„ํ‹ฐ์–ด Lv1. ๊ทผ๋ฌด์‹œ๊ฐ„ ํ’€์ด

์„ ๋‹ฌ 2024. 1. 26. 03:18
๋ฐ˜์‘ํ˜•

https://softeer.ai/practice/6254

 

Softeer - ํ˜„๋Œ€์ž๋™์ฐจ๊ทธ๋ฃน SW์ธ์žฌํ™•๋ณดํ”Œ๋žซํผ

 

softeer.ai

 

๋ฌธ์ œ ์š”์•ฝ

์ถœ๊ทผ ์‹œ๊ฐ๊ณผ ํ‡ด๊ทผ ์‹œ๊ฐ์ด ๊ฐ๊ฐ HH:MM HH:MM ๊ณผ ๊ฐ™์€ ํ˜•์‹์œผ๋กœ ์ฃผ์–ด์ง€๊ณ ,

๊ทผ๋ฌดํ•œ ์‹œ๊ฐ„์˜ ์ด ํ•ฉ์„ ๋ถ„์œผ๋กœ ๊ณ„์‚ฐํ•˜๋Š” ๋ฌธ์ œ.

 

๋ฌธ์ž์—ด๋กœ ์ฃผ์–ด์ง„ ์ž…๋ ฅ ๊ฐ’์„ ์ •์ˆ˜๋กœ ๋ฐ”๊ฟ”์„œ ๋‹ค๋ฃจ๋Š” ๋ถ€๋ถ„ ๋ง๊ณ ๋Š” ์ •๋ง ๋‹จ์ˆœํ•œ ๋ฌธ์ œ๋‹ค

 

 

#include <iostream>

using namespace std;

const int arr[] = {600, 60, 0, 10, 1};

int cal(string s) {
    int min = 0;
    for(int i=0; i<s.size(); i++) {
        min += s[i] * arr[i];
    }
    return min;
}

int main() {
    string a,b;
    int ans = 0;
    for(int i=0; i<5; i++) {
        cin >> a >> b;
        ans += cal(b) - cal(a);
    }
    cout << ans;
    return 0;
}

 

๋ฐ˜์‘ํ˜•