LightOJ 1078 Integer Divisibility Solution
Problem Link: https://lightoj.com/problem/integer-divisibility
Solution in C++:
///La ilaha illellahu muhammadur rasulullah
///******Bismillahir-Rahmanir-Rahim******///
///Abul Hasnat Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,t,ts,d,a,cn;
cin>>t;
for(ts=1; ts<=t; ts++)
{
cin>>d>>n;
cn=a=0;
while(1)
{
a=((a*10)+n)%d;
cn++;
if(a==0)
break;
}
cout << "Case " <<ts<< ": "<<cn<<endl;
}
}
No comments