Submission #375118

#TimeUsernameProblemLanguageResultExecution timeMemory
375118IldarKASifra (COCI21_sifra)C++14
50 / 50
1 ms364 KiB
#include <bits/stdc++.h> using namespace std; string s; int cnt; int main(){ cin >> s; bool ok = 0; int san = 0; vector < int > v; for(int i = 0; i < s.size(); i++){ if(s[i] >= '0' && s[i] <= '9'){ san = (san * 10) + int(s[i] - '0'); if(!ok){ ok = 1; } if(i + 1 == (int)s.size()){ v.push_back(san); } } else{ if(ok){ v.push_back(san); san = 0; ok = 0; } } } sort(v.begin(), v.end()); v.resize(unique(v.begin(), v.end()) - v.begin()); cout << v.size(); }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:11:22: 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++){
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...