https://dev-repository.tistory.com/63

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


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



#include <iostream>
 
using namespace std;
 
int main(void) {
 
    for(int t_case=0; t_case<10; t_case++) {
        int score[101= {0}, temp, max=0, max_students=0;
 
        cin >> temp;
        
        for(int i=0; i<1000; i++) {
            cin >> temp;
            score[temp]++;
        }
 
        for(int i=0; i<101; i++) {
            if(score[i] >= max_students) {
                max = i;
                max_students = score[i];
            }
        }
 
        cout << "#" << t_case+1 << " " << max << "\n";
    }
 
    return 0;
}
cs


https://dev-repository.tistory.com/50

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


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



#include <iostream>
 
using namespace std;
 
int main(void) {
    int T, N;
 
    cin >> T;
 
    for(int t_case=0; t_case<T; t_case++) {
        cin >> N;
 
        string cards[N];
 
        cout << "#" << t_case+1;
 
        for(int i=0; i<N; i++) {
            cin >> cards[i];
        }
 
        for(int i=0; i<N; i++) {
            if(i%2 == 0) {
                cout << " " << cards[i/2];
            } else if(N%2 == 0){
                cout << " " << cards[N/2 + i/2];
            } else {
                cout << " " << cards[N/2 + 1 + i/2];
            }
        }
 
        cout << "\n";
    }
 
    return 0;
}
cs

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


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



#include <iostream>
#include <stack>
 
using namespace std;
 
int main(void) {
    int length;
    char temp;
    string input;
 
 
    for(int t_case=0; t_case<10; t_case++) {
        string postfix = "";
 
        cin >> length;
        cin >> input;
 
        for(int i=0; i<length; i++) {
            if(input.at(i) == '+') {
                postfix += input.at(++i);
                postfix += '+';
            } else {
                postfix += input.at(i);
            }
        }
 
        int answer = 0;
        for(int i=0; i<length; i++) {
            if(postfix.at(i) != '+')
                answer += (postfix.at(i) - '0');
        }
 
        cout << "#" << t_case+1 << " " << answer << "\n";
    }
 
    return 0;
}
cs

+ Recent posts