답안 #153845

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
153845 2019-09-17T04:50:15 Z Ruxandra985 Karte (COCI15_karte) C++14
50 / 50
2 ms 504 KB
#include <cstdio>
#include <set>
using namespace std;
set <int> s[4];
int main()
{
    FILE *fin = stdin;
    FILE *fout = stdout;
    int nr;
    char c;
    c = fgetc (fin);
    while (c=='P' || c =='K' || c == 'H' || c =='T'){
        nr = (fgetc(fin)-'0') * 10 + (fgetc(fin)-'0');
        if (c == 'P'){
            if (s[0].find(nr) != s[0].end()){
                fprintf (fout,"GRESKA");
                return 0;
            }
            s[0].insert(nr);
        }
        else if (c == 'K'){
            if (s[1].find(nr) != s[1].end()){
                fprintf (fout,"GRESKA");
                return 0;
            }
            s[1].insert(nr);
        }
        else if (c == 'H'){
            if (s[2].find(nr) != s[2].end()){
                fprintf (fout,"GRESKA");
                return 0;
            }
            s[2].insert(nr);
        }
        else if (c == 'T'){
            if (s[3].find(nr) != s[3].end()){
                fprintf (fout,"GRESKA");
                return 0;
            }
            s[3].insert(nr);
        }
        c = fgetc(fin);
    }
    fprintf (fout,"%d %d %d %d" , 13 - s[0].size() , 13 - s[1].size() , 13 - s[2].size() , 13 - s[3].size() );
    return 0;
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:44:109: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
     fprintf (fout,"%d %d %d %d" , 13 - s[0].size() , 13 - s[1].size() , 13 - s[2].size() , 13 - s[3].size() );
                                   ~~~~~~~~~~~~~~~~                                                          ^
karte.cpp:44:109: warning: format '%d' expects argument of type 'int', but argument 4 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
karte.cpp:44:109: warning: format '%d' expects argument of type 'int', but argument 5 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
karte.cpp:44:109: warning: format '%d' expects argument of type 'int', but argument 6 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 380 KB Output is correct