solved beautiful days at the movies

Signed-off-by: ayham <altffour@protonmail.com>
This commit is contained in:
ayham 2021-05-09 18:51:07 +03:00
parent 79297f1383
commit f1f1f52eb2
No known key found for this signature in database
GPG Key ID: 81D38F7122AFCC94
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
#include <bits/stdc++.h>
using namespace std;
int reverse(int num) {
string tmp = to_string(num);
reverse(tmp.begin(), tmp.end());
return stoi(tmp);
}
int main() {
int i, j, k, res = 0;
cin >> i >> j >> k;
for (; i <= j; i++)
if (abs(i-reverse(i)) % k == 0) res++;
cout << res << endl;
return 0;
}