답안 #1098477

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1098477 2024-10-09T12:45:48 Z venoman Sifra (COCI21_sifra) C++17
50 / 50
1 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
	string s;
	cin >> s;
	int duzina = 0;
	int n = 0;
	map<int, int> mapa;
	for(int i = 0; i < s.size(); i++){
		if(isdigit(s[i]) && duzina == 0){
			duzina++;
			n+=s[i]-'0';
		}
		else if(isdigit(s[i]) && duzina > 0){
			duzina++;
			n*=10;
			n+=s[i]-'0';
		}
		else if(isdigit(s[i-1]) && !isdigit(s[i])){
			duzina = 0;
			mapa[n]++;
			n = 0;
		}
	}
	if(duzina > 0) mapa[n]++;
	cout<<mapa.size();
}

Compilation message

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