제출 #1120696

#제출 시각아이디문제언어결과실행 시간메모리
1120696vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
50.83 / 100
1099 ms512 KiB
#include <iostream> #include <cstdint> #include <cstring> int a, b, ans = 0, n; char str[20] = {'0'}; uint8_t i, j; uint32_t k, d, e; void toString(char str[], int n) { if (n == 0) { str[0] = '0'; return; } for (i = 0; n > 0; i++) { str[i] = '0' + n % 10; n /= 10; } str[i + 1] = '\0'; } int main(void) { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cin >> a >> b; for (n = a; n <= b; n++) { toString(str, n); for (i = 0; i < strlen(str); i++) { for (j = 2; j <= strlen(str) - i; j++) { e = j / 2; d = i + e + j % 2; for (k = i; k < d; k++) { if (str[k] != str[i + i + e + j - k - 2]) { break; } if (k == d - 1) { goto next; } } } } ans++; next: continue; } std::cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...