제출 #1120510

#제출 시각아이디문제언어결과실행 시간메모리
1120510vjudge1Palindrome-Free Numbers (BOI13_numbers)C++14
39.17 / 100
1101 ms512 KiB
// author - alimammadzade

#include <bits/stdc++.h>
#define int long long
using namespace std;

bool free(int i) {
    string s = to_string(i);
    for (int i = 0; i < (int)s.size() - 1; i++)
        for (int j = i + 1; j < (int)s.size(); j++) {
            string a = s.substr(i, j - i + 1), b = a;
            reverse(b.begin(), b.end());
            if (a == b) return 0;
        }
    return 1;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    // system("cls"), freopen("in.txt", "r", stdin);
    int a, b, res = 0;
    scanf("%d %d", &a, &b);
    for (int i = a; i <= b; i++) res += free(i);
    printf("%d", res);
}

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

numbers.cpp: In function 'int main()':
numbers.cpp:22:13: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   22 |     scanf("%d %d", &a, &b);
      |            ~^      ~~
      |             |      |
      |             int*   long long int*
      |            %lld
numbers.cpp:22:16: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   22 |     scanf("%d %d", &a, &b);
      |               ~^       ~~
      |                |       |
      |                int*    long long int*
      |               %lld
numbers.cpp:24:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   24 |     printf("%d", res);
      |             ~^   ~~~
      |              |   |
      |              int long long int
      |             %lld
numbers.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf("%d %d", &a, &b);
      |     ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...