제출 #500739

#제출 시각아이디문제언어결과실행 시간메모리
500739MurotYPalindrome-Free Numbers (BOI13_numbers)C++14
27.50 / 100
1093 ms292 KiB
#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ff first
#define ll long long
#define ss second
using namespace std;
const int N=1e6+1;

bool ok(ll n){
	string s;
	while (n){
		s=char(48+(n % 10))+s;
		n/=10;
	}
	
	for (int i=0;i<s.size();i++){
		for (int j=i+1;j<s.size();j++){
			int q=j;
			bool ok=1;
			for (int j1=i;j1<=j;j1++){
				if (s[j1] != s[q]){
					ok=0;
					break;
				}
				q--;
			}
			if (ok) return 1;
		}
	}
	return 0;
}
int main()
{
	ll a, b, ans=0;
	
	cin >> a >> b;
	
	for (int i=a;i<=b;i++){
		if (!ok(i)) ans++;
	}
	cout << ans;
}

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

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