제출 #1120551

#제출 시각아이디문제언어결과실행 시간메모리
1120551vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
15 / 100
1096 ms131072 KiB
#include <bits/stdc++.h> using namespace std; unordered_set<int> st; int lf,rf; bool da(int a){ vector<int> sira; while(a){ sira.push_back(a % 10); a /= 10; } int l=0,r=sira.size() - 1; while(l < r){ if(sira[l] != sira[r])return 0; l++; r--; } return 1; } void qur(int a,int cnt){ if(a > rf)return; if(lf <= a)st.insert(a); for(int i=0;i<=9;++i){ qur(a * 10 + i,cnt+1); if(i){ qur(i * pow(10,cnt) + a,cnt+1); } } } bool check(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; cin >> a >> b; lf = a; rf = b; int cnt=2; for(int i=11;i<=999;++i){ if(i >= 100)cnt = 3; if(da(i) || i % 100 == 0){ qur(i,cnt); } } cout << rf - lf + 1 - st.size(); }

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

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