Submission #375353

# Submission time Handle Problem Language Result Execution time Memory
375353 2021-03-09T09:51:03 Z muhi1112 Sifra (COCI21_sifra) C++17
50 / 50
1 ms 512 KB
#include <bits/stdc++.h>
using namespace std;

#define f1 first
#define s2 second
#define INF 99999999
#define ll long long
#define pb push_back
#define fri(a) freopen(a,"r",stdin)
#define fro(a) freopen(a,"w",stdout)
const int N=2e5+5;

string s;
set<int>sety;

void solve(){
	cin>>s;
	for(int i=0;i<s.length();i++){
		if((s[i]%'a'>=48)){
			if(i+1<s.length() && s[i+1]%'a'>=48){
				if(i+2<s.length() && s[i+2]%'a'>=48){
					sety.insert(((s[i]%'a')%48)*100+((s[i+1]%'a')%48)*10+((s[i+2]%'a')%48));
					i+=2;
				}
				else{
					sety.insert(((s[i]%'a')%48)*10+((s[i+1]%'a')%48));
					i++;
				}
			}
			else sety.insert(((s[i]%'a')%48));
		}
	}
	cout<<sety.size()<<endl;
}

int main(){

	//fri("in.txt");
	//fro("out.txt");
	solve();

	return 0;
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:18:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  for(int i=0;i<s.length();i++){
      |              ~^~~~~~~~~~~
Main.cpp:20:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |    if(i+1<s.length() && s[i+1]%'a'>=48){
      |       ~~~^~~~~~~~~~~
Main.cpp:21:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     if(i+2<s.length() && s[i+2]%'a'>=48){
      |        ~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 364 KB Output is correct