답안 #474713

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
474713 2021-09-19T14:08:18 Z mychecksedad Sifra (COCI21_sifra) C++17
45 / 50
1 ms 204 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define all(x) x.begin(), x.end()
const int N = 3e5+100, M = 1e5+10, F = 2147483646, K = 20;


string s;
set<string> se;
map<char, bool> c;
int main(){
    cin.tie(0); ios::sync_with_stdio(0);
    cin >> s;
    for(char cc='0'; cc <= '9'; cc++) c[cc] = 1;
    s += "??";
    for(int i = 0; i < s.length() - 2; i++){
        if(c[s[i]] && c[s[i + 1]] && c[s[i + 2]]){
            string t = "";
            t += s[i]; 
            t += s[i+1]; 
            t += s[i+2]; 
            se.insert(t);
            i += 2;
        }else if(c[s[i]] && c[s[i + 1]]){
            string t = "";
            t += s[i]; 
            t =+ s[i+1]; 
            se.insert(t);
            ++i;
        }else if(c[s[i]]){
            string t = "";
            t += s[i]; 
            se.insert(t);
        }
    }
    cout << se.size();




    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for(int i = 0; i < s.length() - 2; i++){
      |                    ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct