Submission #858364

# Submission time Handle Problem Language Result Execution time Memory
858364 2023-10-08T08:48:49 Z reginox Bridž (COCI17_bridz) C++17
50 / 50
1 ms 600 KB
#include <bits/stdc++.h>
#define ll long long
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define sp << " "
#define task "card"
using namespace std;
ll t;
char c;
string s;
ll sum = 0;
int main(){
	if(fopen(task".inp","r")){
		freopen(task".inp","r",stdin);
		freopen(task".out","w",stdout);
	}
	faster
	cin >> t;
	while(t--){
		cin >> s;
		for(ll i = 0; i < s.size(); i++){
			c = s[i];
			if(c=='A') sum+=4;
			else if (c=='K') sum+=3;
			else if (c=='Q') sum+=2;
			else if (c=='J') sum++;
		}
	}
	cout << sum;
	return 0;
}

Compilation message

bridz.cpp: In function 'int main()':
bridz.cpp:20: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]
   20 |   for(ll i = 0; i < s.size(); i++){
      |                 ~~^~~~~~~~~~
bridz.cpp:13:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   freopen(task".inp","r",stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
bridz.cpp:14:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   freopen(task".out","w",stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 456 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct