답안 #1024046

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1024046 2024-07-15T10:46:54 Z kustizus Sifra (COCI21_sifra) C++17
50 / 50
1 ms 452 KB
#include <bits/stdc++.h>
#define ll long long int

using namespace std;

ll ans=0;
string s,t="";
unordered_map <string,ll> mp;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    getline (cin,s);
    for (ll i=0;i<s.size();i++)
        if (s[i]>='0' && s[i]<='9') t+=s[i];
        else if (t!=""){
            if (mp[t]==0) ans++;
            mp[t]=1;
            t="";
        }
    if (t!=""){
        if (mp[t]==0) ans++;
        mp[t]=1;
    }
    cout<<ans;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:13:18: 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]
   13 |     for (ll i=0;i<s.size();i++)
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 452 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct