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
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
 
int main(void) {
    int month, day;
    int total_day = 0;
    
    std::cin >> month;
    std::cin >> day;
    
    for(int i=1; i<month; i++) {
        switch(i) {
            case 4:
            case 6:
            case 9:
            case 11:
                total_day += 30;
                break;
            case 2:
                total_day += 28;
                break;
            default:
                total_day += 31;
                break;
        }
    }
    
    total_day += day;
    
    switch(total_day % 7) {
        case 0:
            std::cout << "SUN" << std::endl;
            break;
        case 1:
            std::cout << "MON" << std::endl;
            break;
        case 2:
            std::cout << "TUE" << std::endl;
            break;
        case 3:
            std::cout << "WED" << std::endl;
            break;
        case 4:
            std::cout << "THU" << std::endl;
            break;
        case 5:
            std::cout << "FRI" << std::endl;
            break;
        case 6:
            std::cout << "SAT" << std::endl;
            break;
    }
    
    return 0;
}
cs


'C & C++ > Baekjoon' 카테고리의 다른 글

백준 2438 - 별찍기 1  (0) 2017.12.27
백준 1978 - 소수 찾기  (0) 2017.12.27
백준 1546 - 평균  (0) 2017.12.27
백준 1316 - 그룹 단어 체커  (0) 2017.12.27
백준 1157 - 단어 공부  (0) 2017.12.27


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
#include <iostream>
 
using namespace std;
 
int main(void) {
    int N;
    cin >> N;
    float score[N];
    float max=0;
    float sum = 0;
    
    for(int i=0; i<N; i++) {
        cin >> score[i];
        if(score[i] > max)
            max = score[i];
    }
    
    for(int i=0; i<N; i++) {
        sum += (score[i]/max)* 100;
    }
    
    cout << sum/<< endl;
    
    return 0;
}
cs


'C & C++ > Baekjoon' 카테고리의 다른 글

백준 1978 - 소수 찾기  (0) 2017.12.27
백준 1924 - 2007년  (0) 2017.12.27
백준 1316 - 그룹 단어 체커  (0) 2017.12.27
백준 1157 - 단어 공부  (0) 2017.12.27
백준 1152 - 단어의 개수  (0) 2017.12.27


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
42
#include <iostream>
#include <string>
 
using namespace std;
 
int main(void) {
    int N, answer = 0;
    bool isUsed[26];
    cin >> N;
    string input;
 
    for(int i=0; i<N; i++) {
        cin >> input;
        bool isGroup = true;
 
        for(int j=0; j<26; j++)
            isUsed[j] = false;
 
        for(int j=0; j<input.length(); j++) {
            if(isUsed[input.at(j) - 'a']) {
                isGroup = false;
                break;
            } else {
                isUsed[input.at(j) - 'a'= true;
                while((j+1 < input.length())) {
                    if(input.at(j) == input.at(j+1))
                        j++;
                    else
                        break;
                }
            }
        }
 
        if(isGroup) {
            answer++
        }
    }
 
    cout << answer << endl;
 
    return 0;
}
cs


'C & C++ > Baekjoon' 카테고리의 다른 글

백준 1924 - 2007년  (0) 2017.12.27
백준 1546 - 평균  (0) 2017.12.27
백준 1157 - 단어 공부  (0) 2017.12.27
백준 1152 - 단어의 개수  (0) 2017.12.27
백준 1110 - 더하기 사이클  (0) 2017.12.27


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
#include <iostream>
 
using namespace std;
 
int main(int argc, char *argv[]) {
    string s;
    int cnt[26= {0};
    char c;
    getline(cin, s, '\n');
    
    for(int i=0; i<s.length(); i++) {
        c = s.at(i);
        if(c <= 'Z')
            c = c - 'A';
        else
            c = c - 'a';
        
        cnt[c]++;
    }
    
    int max = -1, idx;
    for(int i=0; i<26; i++) {
        if(max < cnt[i]) {
            max = cnt[i];
            idx = i;
        }
    }
    for(int i=0; i<26; i++) {
        if(max == cnt[i] && i != idx) {
            cout << "?" << endl;
            return 0;
        }
    }
    cout << (char)(idx+'A'<< endl;
}
cs


'C & C++ > Baekjoon' 카테고리의 다른 글

백준 1546 - 평균  (0) 2017.12.27
백준 1316 - 그룹 단어 체커  (0) 2017.12.27
백준 1152 - 단어의 개수  (0) 2017.12.27
백준 1110 - 더하기 사이클  (0) 2017.12.27
백준 1065 - 한수  (0) 2017.12.27


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
42
43
44
#include <iostream>
#include <string>
 
using namespace std;
 
int main(int argc, char *argv[]) {
    string input;
    int cnt, i;
    getline(cin, input, '\n');
    
    if(input.length() == 0) {
        cnt = 0;
    } else {
        bool isAllSpace = true;
        for(i=0; i<input.length(); i++) {
            if(input.at(i) != ' ') {
                isAllSpace = false;
                break;
            }
        }
        
        if(isAllSpace) {
            cnt = 0;
        } else {
            cnt = 1;
            for(; i<input.length(); i++) {
                if(input.at(i) == ' ') {
                    if((i>0& (input.at(i-1== ' ')) {
                        cnt--;
                        break;
                    }
                    else
                        cnt++;
                }
            }
            if((input.at(input.length()-1== ' '& (input.at(input.length()-2!= ' '))
                cnt--;
        }
    }
    
    cout << cnt << endl;
    
    return 0;
}
cs


'C & C++ > Baekjoon' 카테고리의 다른 글

백준 1316 - 그룹 단어 체커  (0) 2017.12.27
백준 1157 - 단어 공부  (0) 2017.12.27
백준 1110 - 더하기 사이클  (0) 2017.12.27
백준 1065 - 한수  (0) 2017.12.27
백준 1008 - A/B  (0) 2017.12.27

+ Recent posts