답안 #633189

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
633189 2022-08-21T20:09:26 Z ahmed_shafik Marko (COCI15_marko) C++17
50 / 50
18 ms 1364 KB
#include <bits/stdc++.h>
#define ahmed_is_fast             \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define ll long long
#define ld long double
#define cc(n) cout << n << "\n"
#define ccc(n) cout << n << ' '
#define endl "\n"
#define all(v) v.begin(), v.end()
#define mx(a, b) a = max(a, b)
#define mn(a, b) a = min(a, b)
#define mem(a, b) memset(a, b, sizeof(a))
#define f(a) a.first
#define s(a) a.second
#define lcm(a, b) (a * b) / __gcd(a, b)
#define sp(x) setprecision(x)
using namespace std;
void ahmed()
{
    ll n;
    cin >> n;
    string s;
    string t[n + 9];
    for (ll i = 0; i < n; i++)
    {
        cin >> t[i];
    }
    cin>>s;
    ll x=0;
    for(ll i=0; i<n; i++)
    {
        if(t[i].size()!=s.size())
        {
            continue;
        }
        bool b=false;
        for(ll j=0; j<t[i].size(); j++)
        {
            string a=t[i];
            ll c=a[j]-'a';
            if(c>-1&&c<3)
            {
                if(s[j]=='2')
                {
                    b=true;
                }
                else
                {
                    b=false;
                    break;
                }
            }
            else if(c>2&&c<6)
            {
                if(s[j]=='3')
                {
                    b=true;
                }
                else
                {
                    b=false;
                    break;
                }
            }
            else if(c>5&&c<9)
            {
                if(s[j]=='4')
                {
                    b=true;
                }
                else
                {
                    b=false;
                    break;
                }
            }
            else if(c>8&&c<12)
            {
                if(s[j]=='5')
                {
                    b=true;
                }
                else
                {
                    b=false;
                    break;
                }
            }
            else if(c>11&&c<15)
            {
                if(s[j]=='6')
                {
                    b=true;
                }
                else
                {
                    b=false;
                    break;
                }
            }
            else if(c>14&&c<19)
            {
                if(s[j]=='7')
                {
                    b=true;
                }
                else
                {
                    b=false;
                    break;
                }
            }
            else if(c>18&&c<22)
            {
                if(s[j]=='8')
                {
                    b=true;
                }
                else
                {
                    b=false;
                    break;
                }
            }
            else if(c>21&&c<26)
            {
                if(s[j]=='9')
                {
                    b=true;
                }
                else
                {
                    b=false;
                    break;
                }
            }
        }
        if(b)
        {
            x++;
        }
    }
    cout<<x<<endl;
}
bool AHMED = false;
int main()
{
    ahmed_is_fast;
    ll t = 1;
    if (AHMED)
    {
        cin >> t;
    }
    while (t--)
    {
        ahmed();
    }
    return 0;
}

Compilation message

marko.cpp: In function 'void ahmed()':
marko.cpp:39:22: 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]
   39 |         for(ll j=0; j<t[i].size(); j++)
      |                     ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 18 ms 1336 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 4 ms 876 KB Output is correct
8 Correct 18 ms 1364 KB Output is correct
9 Correct 3 ms 464 KB Output is correct
10 Correct 15 ms 980 KB Output is correct