jakaria_hossain

lightoj - 1214 - Large Division

Aug 22nd, 2019
126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. int main()
  5. {
  6. int test;
  7. cin>>test;
  8. for(int t=1;t<=test;t++)
  9. {
  10. ll temp=0,b,j=0;
  11. string a;
  12. cin>>a;
  13. if(a[0]=='-')j=1;
  14. cin>>b;
  15. for(j;j<a.size();j++)
  16. {
  17. temp=temp*10+(a[j]-'0');
  18. temp=temp%b;
  19. //cout<<temp<<endl;
  20. }
  21. if(temp==0)printf("Case %d: divisible\n",t);
  22. else printf("Case %d: not divisible\n",t);
  23. }
  24. }
RAW Paste Data