Submission #1120792

#TimeUsernameProblemLanguageResultExecution timeMemory
1120792vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
0 / 100
1098 ms516 KiB
#include <bits/stdc++.h> #define GOOD_LUCK ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define int long long #define itn int #define Int int #define INF -1000000 #define MOD 1000000007 #define endl "\n" #define ff first #define ss second #define all(v) v.begin(), v.end() using namespace std; int temp; vector <vector<int>> dp; bool pnd(string a) { string b = a; reverse(a.begin(), a.end()); return (a == b); } bool sub_pnd(string a, int x, int y) { int k=0, m = (x + y - 1) / 2; while (k <= m - x) { if (a[x+k] != a[y -k]) return false; k++; } return true; } bool check(int n) { string a = to_string(n); int x = a.size(); for (int i=0; i < x-1; i++) { for (int j=i+1; j < x; j++) { if (sub_pnd(a, i, j)) return false; } } return true; } signed main() { GOOD_LUCK int t; t = 1; // cin >> t; while (t--) { int a, b; scanf("%d%d", &a, &b); int cnt=0; for (int i=a; i <= b; i++) { if (check(i)) cnt++; } printf("%d", &cnt); } return 0; } // Problem C // by Ekber_Ekber

Compilation message (stderr)

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