답안 #376747

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
376747 2021-03-12T03:07:18 Z marat0210 Karte (COCI15_karte) C++14
50 / 50
1 ms 364 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s;
    cin >>s;
    set <string> st;
    long long cnt = 0;
    for (int i = 0; i < s.size(); i += 3) {
        string k = s.substr(i, 3);
        st.insert(k);
        cnt++;
    }
    if (st.size() == cnt) {
        long long p = 0, f = 0, h = 0, t = 0;
        for (int i = 0; i < s.size(); i += 3) {
            string k = s.substr(i, 3);
            if (k[0] == 'P') p++;
            else if (k[0] == 'K') f++;
            else if (k[0] == 'H') h++;
            else if (k[0] == 'T') t++;
        }
        cout <<13 - p<<" "<<13 - f<<" "<<13 - h<<" "<<13 - t<<endl;
    }
    else {
        cout <<"GRESKA"<<endl;
    }
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 0; i < s.size(); i += 3) {
      |                     ~~^~~~~~~~~~
karte.cpp:16:19: warning: comparison of integer expressions of different signedness: 'std::set<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   16 |     if (st.size() == cnt) {
      |         ~~~~~~~~~~^~~~~~
karte.cpp:18:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for (int i = 0; i < s.size(); i += 3) {
      |                         ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct