문제 링크 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5PnnU6AOsDFAUq


문제의 저작권은 SW Expert Academy에 있습니다.



#include <iostream>
 
using namespace std;
 
int main(void) {
    int T;
    int days[12= {312831303130313130313031};
    cin >> T;
 
    for(int t_case=0; t_case<T; t_case++) {
        int a[2], b[2];
        int answer;
        cin >> a[0>> a[1>> b[0>> b[1];
 
        if(a[0== b[0]) {
            answer = b[1- a[1+ 1;
        } else {
            answer = days[a[0]-1- a[1+ 1;
            a[0]++;
            while(a[0!= b[0]) {
                answer += days[a[0]-1];
                a[0]++;
            }
            answer += b[1];
        }
 
        cout << "#" << t_case+1 << " " << answer << "\n";
    }
 
    return 0;
}
cs

'C & C++ > SW Expert Academy' 카테고리의 다른 글

SWEA 1945 - 간단한 소인수분해  (0) 2018.04.28
SWEA 1946 - 간단한 압축 풀기  (0) 2018.04.28
SWEA 1954 - 달팽이 숫자  (0) 2018.04.28
SWEA 1959 - 두 개의 숫자열  (0) 2018.04.28
SWEA 1961 - 숫자 배열 회전  (0) 2018.04.28

+ Recent posts