Submission #207727

# Submission time Handle Problem Language Result Execution time Memory
207727 2020-03-08T17:13:54 Z DodgeBallMan Bridž (COCI17_bridz) C++14
50 / 50
7 ms 380 KB
#include <bits/stdc++.h>

using namespace std;

int ans, n;
char s[20];

int cal( char a ) {
    if( a == 'A' ) return 4;
    else if( a == 'K' ) return 3;
    else if( a == 'Q' ) return 2;
    else if( a == 'J' ) return 1;
    return 0;
}

int main() 
{
    scanf("%d",&n);
    for( int i = 1 ; i <= n ; i++ ) {
        scanf("%s",s);
        for( int j = 0 ; j < 13 ; j++ ) ans += cal( s[j] );
    }
    printf("%d",ans);
}

Compilation message

bridz.cpp: In function 'int main()':
bridz.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
bridz.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",s);
         ~~~~~^~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 380 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 7 ms 376 KB Output is correct