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

Most View Post

Recent post

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.