Submission #1101641

# Submission time Handle Problem Language Result Execution time Memory
1101641 2024-10-16T13:11:13 Z vjudge1 Bridž (COCI17_bridz) C++17
50 / 50
2 ms 476 KB
#include <bits/stdc++.h>
#define task "TEST"
#define task2 "A"
#define pl pair<int, int>
#define pf push_front
#define pb push_back
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b, c) for (int i=a; i<=b; i+=c)
#define FORE(i, a, b, c) for (int i=a; i>=b; i+=c)
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int Mod = 1e9+7;
const int maxn = 1e7;
const ll Inf = 1e18;
string str; ll res, t;
void Read()
{
    cin >> t;
    while (t--){
        cin >> str;
        FOR(i, 0, str.length()-1, 1) {
            if (str[i] == 'A') res += 4;
            else if (str[i] == 'K') res += 3;
            else if (str[i] == 'Q') res += 2;
            else if (str[i] == 'J') res++;
        }
    }
    cout << res;
}
void Solve()
{

}
int main()
{
    if (fopen (task".inp", "r")) {
        freopen (task".inp", "r", stdin);
        freopen (task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t;
    for (t=1; t--;)
    {
        Read(); Solve();
    }
}

Compilation message

bridz.cpp: In function 'void Read()':
bridz.cpp:12:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | #define FOR(i, a, b, c) for (int i=a; i<=b; i+=c)
......
   26 |         FOR(i, 0, str.length()-1, 1) {
      |             ~~~~~~~~~~~~~~~~~~~~        
bridz.cpp:26:9: note: in expansion of macro 'FOR'
   26 |         FOR(i, 0, str.length()-1, 1) {
      |         ^~~
bridz.cpp: In function 'int main()':
bridz.cpp:42:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |         freopen (task".inp", "r", stdin);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
bridz.cpp:43:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |         freopen (task".out", "w", stdout);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 476 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 2 ms 340 KB Output is correct