Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int n;
- bool ThuanNghich(int x) {
- int tmp = x;
- int dao = 0;
- while(x > 0) {
- dao = dao*10 + x%10;
- x /= 10;
- }
- if(dao == tmp)
- return true;
- return false;
- }
- bool tongchia10(int n) {
- int tong = 0;
- while(n > 0) {
- int t = n % 10;
- tong = tong + t;
- n = n / 10;
- }
- if(tong%10==0)
- return true;
- return false;
- }
- int main() {
- cin >> n;
- int dem = 0;
- for(int i = pow(10,n-1); i < pow(10,n); i++)
- if(ThuanNghich(i) && tongchia10(i))
- dem++;
- cout << dem;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement