Light oj 1214 - Large Division

#include<iostream> #include<bits/stdc++.h> using namespace std; int main() { string s1,s2; long long int i,j,k,t,b,sum=0; cin>>t; for(i=1;i<=t;i++) { j=0; cin>>s1>>b; if(s1[0]=='-') j++; sum=0; while(s1[j]!='\0') { sum=sum*10+(s1[j]-'0'); sum=sum%b; j++; } if(sum==0) { cout<<"Case "<<i<<": "<<"divisible"<<endl; } else { cout<<"Case "<<i<<": "<<"not divisible"<<endl; } } return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.