Advertisement
Eddie_1337

9 atestat

Nov 9th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int oglindit(int n, int k) {
  7.     int z = 0;
  8.     while (n) {
  9.         if (n % 10 != k)
  10.             z = (z * 10) + (n % 10);
  11.         n /= 10;
  12.     }
  13.     return z;
  14. }
  15.  
  16. int main() {
  17.     int n, k, x;
  18.     ifstream f("tipl.in");
  19.     ofstream g("tipl.out");
  20.     f >> n >> k;
  21.     x = oglindit(oglindit(n, k), k);
  22.     g << x << endl;
  23.     x = k;
  24.     while (k * x < n)
  25.         k *= x;
  26.     g << k;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement