답안 #650103

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
650103 2022-10-12T12:43:09 Z berr Karte (COCI15_karte) C++17
50 / 50
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long


int32_t main()
{
    ios_base::sync_with_stdio(false);

    cin.tie(0);
    
    /*#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif  */


    string s; cin>>s;
    int f=s.size()/3;
    set<string> q[4];

    for(int i=0; i<s.size(); i+=3)
    {
        string h=s.substr(i+1, 2);

        if(s[i]=='P')
        q[0].insert(h);
        else if(s[i]=='K')
        q[1].insert(h);
        else if(s[i]=='H')
        q[2].insert(h);
        else
        q[3].insert(h);

    }

    if((s.size()/3)!=(q[3].size()+q[2].size()+q[1].size()+q[0].size()))
    {
        cout<<"GRESKA";
    }
    else
    {
        for(int i=0; i<4; i++)
        {
            cout<<13-q[i].size()<<" ";
        }

    }
}

Compilation message

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