Submission #448444

#TimeUsernameProblemLanguageResultExecution timeMemory
448444fuad27Palindrome-Free Numbers (BOI13_numbers)C++14
36.67 / 100
1097 ms292 KiB
#include<bits/stdc++.h> using namespace std; bool check(string s) { if(s.length() >= 2 and s[0] == s[1])return false; for(int i = 2;i<s.length();i++) { if(s[i] == s[i-2] or s[i] == s[i-1])return false; } return true; } int main () { long long a, b, c = 0; cin >> a >> b; for(long long i = a;i<=b;i++) { string s = to_string(i); if(check(s))c++; } cout<<c; }

Compilation message (stderr)

numbers.cpp: In function 'bool check(std::string)':
numbers.cpp:5:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 |  for(int i = 2;i<s.length();i++) {
      |                ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...