Advertisement
Semior001

T solution - mtd contest 3.1

Jun 14th, 2016
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4.     int a;
  5.     scanf("%d", &a);
  6.     bool found = false;
  7.     int count = 0;
  8.     int l;
  9.     int k;
  10.     while(!found){
  11.         a++;
  12.         count++;
  13.         l = abs(a);
  14.         while(l>0){
  15.             k=l%10;
  16.             l/=10;
  17.             if(k==8){
  18.                 found = true;
  19.                 printf("%d\n", count);
  20.                 return 0;
  21.             }
  22.         }
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement