제출 #1120854

#제출 시각아이디문제언어결과실행 시간메모리
1120854vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
45.83 / 100
1082 ms512 KiB
#include "bits/stdc++.h" #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define pb push_back #define in insert #define F first #define S second #define vll vector<ll> #define all(v) v.begin(),v.end() #define endl '\n' #define pii pair<ll,ll> using namespace std; const ll INF =1e18, mod = 1e9 + 7, N = 1e5 + 5; bool free(ll n){ string s = to_string(n); for(int i = 0; i < s.size(); i++){ for(int j = i + 1; j < s.size(); j++){ string neww = s.substr(i, j - i + 1); string e = neww; reverse(all(neww)); if(neww == e){ return false; } } } return true; } void solve(){ int a,b; cin >> a >> b; int cnt = 0; for(int i = a; i <= b; i++){ if(free(i)){ cnt++; } } cout << cnt << endl; } int main(){ fast; solve(); return 0; }

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

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