Submission #1098474

#TimeUsernameProblemLanguageResultExecution timeMemory
1098474venomanSifra (COCI21_sifra)C++17
30 / 50
0 ms348 KiB
#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.length(); 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(mapa.size() == 0 && duzina > 0){ cout<<1; return 0; } cout<<mapa.size(); }

Compilation message (stderr)

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.length(); i++){
      |                 ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...