# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
474712 | mychecksedad | Sifra (COCI21_sifra) | C++17 | 1 ms | 316 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
}else if(c[s[i]] && c[s[i + 1]]){
string t = "";
t += s[i];
t =+ s[i+1];
se.insert(t);
}else if(c[s[i]]){
string t = "";
t += s[i];
se.insert(t);
}
}
cout << se.size();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |