답안 #523253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
523253 2022-02-07T09:21:07 Z tato Sifra (COCI21_sifra) C++14
50 / 50
1 ms 296 KB
#include <bits/stdc++.h>
#define ll long long


using namespace std;

void answer()
{
	string s;
	cin >> s;
	s += "a";
	
	ll a = 0;
	if('0' < s[0] and s[0] <= '9')
		a = s[0] + 48;
		
	set < ll > st; 
	for(int i = 1; i < s.size(); i++)
		{
			if('0' <= s[i] and s[i] <= '9')
				{
					a *= 10;
					a += (s[i] + 48);
				}
			else
				{
					if('0' <= s[i-1] and s[i-1] <= '9')
						{
							st.insert(a);
							a = 0;
						}
					
				}
		}
	
	cout << st.size();
	
	
}

int main()
{
	int t = 1;
	//cin >> t;
	
	while(t--)
		answer();
	
	return 0;
}

Compilation message

Main.cpp: In function 'void answer()':
Main.cpp:18:19: 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 = 1; i < s.size(); i++)
      |                 ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 288 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 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 1 ms 288 KB Output is correct
10 Correct 1 ms 204 KB Output is correct