제출 #1120662

#제출 시각아이디문제언어결과실행 시간메모리
1120662vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
44.17 / 100
1074 ms508 KiB
#include <bits/stdc++.h>
using namespace std;

bool da(int a){
    vector<int> sira;
    while(a){
        sira.push_back(a % 10);
        a /= 10;
    }
    for(int i=0;i<sira.size();++i){
        vector<int> temp;
        temp.push_back(sira[i]);
        for(int j=i+1;j<sira.size();++j){
            bool nuhuh = 0;
            temp.push_back(sira[j]);
            int l=0,r= temp.size() - 1;
            while(l <= r){
                if(temp[l] != temp[r]){
                    nuhuh = 1;
                    break;
                }
                l++;
                r--;
            }
            if(nuhuh)continue;
            return 0;
        }
    }
    return 1;
}

signed main(){
    int a,b,cnt=0;
    cin >> a >> b;
    for(int i=a;i<=b;++i){
        if(da(i))cnt++;
    }
    cout << cnt;
}
//

컴파일 시 표준 에러 (stderr) 메시지

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