Submission #1294706

#TimeUsernameProblemLanguageResultExecution timeMemory
1294706JohanPalindrome-Free Numbers (BOI13_numbers)C++20
0 / 100
1096 ms580 KiB
#include<bits/stdc++.h> using namespace std; bool ok(long long x){ string s = to_string(x); int n = s.size(); for(int i = 0; i < n - 1; i++){ if(s[i] == s[i + 1])return false; if(i < n - 2 && s[i] == s[i + 2])return false; } return true; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long a, b, ans = 0; cin >> a >> b; for(long long i = a; i <= b; i++){ ans += ok(i); } printf("%dll", ans); }

Compilation message (stderr)

numbers.cpp: In function 'int main()':
numbers.cpp:21:12: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   21 |   printf("%dll", ans);
      |           ~^     ~~~
      |            |     |
      |            int   long long int
      |           %lld
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...