Submission #448424

#TimeUsernameProblemLanguageResultExecution timeMemory
448424fuad27Palindrome-Free Numbers (BOI13_numbers)C++14
24.17 / 100
1098 ms324 KiB
    #include<bits/stdc++.h>
    using namespace std;
    bool is_palindrome(string s) {
    for(int i=0;i<s.size();i++){
        string k="";
        k+=s[i];
        for(int j=i+1;j<s.size();j++){
            k+=s[j];
            string l=k;
            reverse(l.begin(),l.end());
            if(k==l){
                return true;
            }
        }
    }
	return false;	
    }
    int main () {
    	long long a, b, c = 0;
    	cin >> a >> b;
    	for(int i = a;i<=b;i++) {
    		string  k = to_string(i);
    		if(!is_palindrome(k)) {
    			c++;
    		}
    	}cout<<c<<endl;
    }

Compilation message (stderr)

numbers.cpp: In function 'bool is_palindrome(std::string)':
numbers.cpp:4:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 |     for(int i=0;i<s.size();i++){
      |                 ~^~~~~~~~~
numbers.cpp:7:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |         for(int j=i+1;j<s.size();j++){
      |                       ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...