Notice
Recent Posts
Recent Comments
Link
«   2025/09   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Archives
Today
Total
관리 메뉴

히히

4299. 태혁이의 사랑은 타이밍 본문

study/SWEP

4299. 태혁이의 사랑은 타이밍

noun. 2018. 11. 19. 00:56

https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWLv6mx6htoDFAVV&categoryId=AWLv6mx6htoDFAVV&categoryType=CODE


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
using namespace std;
 
int main() {
    int test_case;
    int t;
    int pprday = 11;
    int pprhour = 11;
    int pprminute = 11;
    int day = 0;
    int hour = 0;
    int minute = 0;
    int result;
    cin >> t;
 
    for (test_case = 1; test_case <= t; ++test_case) {
        
        cin >> day >> hour >> minute;
        
        if (pprday == day && pprhour > hour) {
            //result = -1;
            cout << "#" << test_case << " " << -1;
        }
        else {
            day -= pprday;
            day *= 1440;
            hour -= pprhour;
            hour *= 60;
            minute -= pprminute;
 
            result = day + hour + minute;
            cout << "#" << test_case << " " << result;
            
        }
                
        cout << endl;
    }
}
 



result = -1 했는데 값이 아예 안 뜨더라.. 왜그럴까

초기화 안해줘서? ㅠㅠ 모르겠어서 그냥.. -1 출력했다. 걍 첨부터 이렇게 할걸 더 복잡하게 ㅠㅠ

'study > SWEP' 카테고리의 다른 글

4406. 모음이 보이지 않는 사람  (0) 2018.11.20
5789. 현주의 상자 바꾸기  (0) 2018.11.19
5549. 홀수일까 짝수일까  (0) 2018.11.19
1206. View  (0) 2018.11.18
5431. 민석이의 과제 체크  (0) 2018.11.18
Comments