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
관리 메뉴

히히

3456. 직사각형 길이 찾기 본문

study/SWEP

3456. 직사각형 길이 찾기

noun. 2018. 11. 20. 18:04

https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWFPmsqqALwDFAV0&categoryId=AWFPmsqqALwDFAV0&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
40
41
#include<iostream>
#include <stdio.h>
#include<algorithm>
#include <string>
#include <vector>
 
using namespace std;
 
int main(int argc, char** argv)
{
    int test_case;
    int T;
 
    cin >> T;
 
    for (test_case = 1; test_case <= T; ++test_case)
    {
        int a, b, c;
 
        cin >> a >> b >> c;
 
        int ans = 0;
 
        if (a == b) {
            ans = c;
        }
        else {
            int plus = a + b;
            ans = plus - c;
            if (ans <= 0) {
                ans = c;
            }
        }
 
        cout << "#" << test_case << " " << ans;
        cout << endl;
    }
 
    return 0;
}
 



왜 D3인지 모를 문제..

그래도 풀면서 예외 생각 못 해가지구 3번째에 pass

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

3750. Digit sum  (0) 2018.11.20
4406. 모음이 보이지 않는 사람  (0) 2018.11.20
5789. 현주의 상자 바꾸기  (0) 2018.11.19
5549. 홀수일까 짝수일까  (0) 2018.11.19
4299. 태혁이의 사랑은 타이밍  (0) 2018.11.19
Comments