Submission #153866

#TimeUsernameProblemLanguageResultExecution timeMemory
153866nicolaalexandraKarte (COCI15_karte)C++14
50 / 50
2 ms376 KiB
#include <iostream> #include <cstring> using namespace std; int f[5][20],sol[5]; char s[1010]; int n,i,j; int main (){ cin>>s+1; n = strlen (s+1); for (i=1;i<=n;i+=3){ int nr = (s[i+1]-'0')*10+s[i+2]-'0'; if (s[i] == 'P') f[0][nr]++; if (s[i] == 'K') f[1][nr]++; if (s[i] == 'H') f[2][nr]++; if (s[i] == 'T') f[3][nr]++; } for (i=0;i<=3;i++){ int nr = 0; for (j=1;j<=13;j++){ if (f[i][j] > 1){ cout<<"GRESKA"; return 0; } nr += f[i][j]; } sol[i] = 13-nr; } cout<<sol[0]<<" "<<sol[1]<<" "<<sol[2]<<" "<<sol[3]; return 0; }

Compilation message (stderr)

karte.cpp: In function 'int main()':
karte.cpp:9:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     cin>>s+1;
          ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...