Submission #61650

# Submission time Handle Problem Language Result Execution time Memory
61650 2018-07-26T08:54:20 Z win11905 Bridž (COCI17_bridz) C++11
50 / 50
5 ms 968 KB
#include <bits/stdc++.h>
using namespace std;

int sum = 0;
char inp[105], A[] = "XJQKA";
int c[256];

int main() {
    for(int i = 0; i < 5; ++i) c[A[i]] = i;
    int T; scanf("%d", &T);
    while(T--) {
        scanf("%s", inp);
        for(int i = 0; i < 13; ++i) sum += c[inp[i]];
    }
    printf("%d\n", sum);
}

Compilation message

bridz.cpp: In function 'int main()':
bridz.cpp:9:38: warning: array subscript has type 'char' [-Wchar-subscripts]
     for(int i = 0; i < 5; ++i) c[A[i]] = i;
                                      ^
bridz.cpp:13:52: warning: array subscript has type 'char' [-Wchar-subscripts]
         for(int i = 0; i < 13; ++i) sum += c[inp[i]];
                                                    ^
bridz.cpp:10:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int T; scanf("%d", &T);
            ~~~~~^~~~~~~~~~
bridz.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s", inp);
         ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 4 ms 488 KB Output is correct
5 Correct 2 ms 652 KB Output is correct
6 Correct 3 ms 680 KB Output is correct
7 Correct 2 ms 740 KB Output is correct
8 Correct 3 ms 844 KB Output is correct
9 Correct 3 ms 864 KB Output is correct
10 Correct 5 ms 968 KB Output is correct