답안 #810694

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
810694 2023-08-06T14:10:23 Z Tunglam07 Sifra (COCI21_sifra) C++17
50 / 50
1 ms 300 KB
#include<bits/stdc++.h>
using namespace std;
 
	
int main()
{
	string s, s1 = "";
	map<string, bool> mp;
	cin >> s;
	int cnt = 0;
	for(int i = 0; i < s.size(); ++i)
	{
		if(s[i] < 48 || s[i] > 57)	
		{
		continue;
		}
		while(s[i] >= 48 && s[i] <= 57)
		{
			s1 += s[i];
			++i;
		}
		if(!mp[s1])	
		{
			++cnt;
		}
		mp[s1] = 1;
		s1 = "";
	}
	cout << cnt;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:11:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |  for(int i = 0; i < s.size(); ++i)
      |                 ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct