In this post, the Giga Tower Codeforces Solution is given. Question details : Codeforces Round #278 (Div. 2), problem: (A) Giga Tower.
Giga Tower Codeforces Solution
#include<bits/stdc++.h>using namespace std;const int MOD=1000000007;#define ll long long#define Fastio ios_base::sync_with_stdio(false); cin.tie(NULL);int main(){Fastio;ll a,n,i,flag=0;cin>>a;if(a>=-8 && a<8)cout<<8-a<<endl;else{for(i=1;i<=10;i++){if(flag==1)break;else{n=a+i;while(n!=0){if(n%10==8 || n%10==-8){cout<<i<<endl;flag=1;break;}n=n/10;}}}}}
Giga Tower Codeforces Solution by Vishal Vaibhab (IIT BHU). If you like TheCode11, then do follow us on Facebook, Twitter and Instagram.