이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
██╗░░██╗████████╗██╗░░░░░███╗░░░███╗
██║░░██║╚══██╔══╝██║░░░░░████╗░████║
███████║░░░██║░░░██║░░░░░██╔████╔██║
██╔══██║░░░██║░░░██║░░░░░██║╚██╔╝██║
██║░░██║░░░██║░░░███████╗██║░╚═╝░██║
╚═╝░░╚═╝░░░╚═╝░░░╚══════╝╚═╝░░░░░╚═╝
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define int l
#define f first
#define ara <<" "<<
#define s second
#define endl '\n'
#define l long long
#define pb push_back
#define pairs pair<l,l>
#define all(v) v.begin(),v.end()
#define yesno(v) ((v) ? "YES" : "NO")
#define dbg(x) cout<<#x<<" = "<<x<<endl;
#define filereader() ifstream cin(input);
#define fileprinter() ofstream cout(output);
#define fast ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int> , rb_tree_tag, tree_order_statistics_node_update> indexed_set;
ifstream in;
ofstream out;
l gcd(l a, l b){
return (b == 0) ? a : gcd(b, a%b);
}
const l N = 3e5 + 5;
const l INF = 1e18;
const l mod = 1e9 + 7;
const string input = "input.txt";
const string output = "output.txt";
l delta = 0;
bool on = false;
l ch(l n){
string s = to_string(n);
for(int i = 0 ; i < s.size(); i++){
for(int j = i + 1 ; j < s.size();j++){
string p = s.substr(i, j - i + 1);
string k = p;reverse(all(k));
if(k == p){
delta = s.size() - j - 1;
on = true;
return 0;
}
}
}
return 1;
}
signed main(){
fast;
l a,b;
cin>>a>>b;
l ans = 0;
for(int i = a ; i <= b;i++){
on = false;
ans += ch(i);
if(on){
i += pow(10,delta) - 1;
}
}
cout<<ans<<endl;
}
컴파일 시 표준 에러 (stderr) 메시지
numbers.cpp: In function 'long long int ch(long long int)':
numbers.cpp:55:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
55 | for(int i = 0 ; i < s.size(); i++){
| ~~^~~~~~~~~~
numbers.cpp:56:31: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
56 | for(int j = i + 1 ; j < s.size();j++){
| ~~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |