#include<iostream> #include<cstdio> #include<cmath> #include<vector> #include<queue> #include<cstring> using namespace std; int main() { //freopen("in.txt" , "r", stdin); string a; long long b, rem; int test, t, i; cin>> test; for(t=1; t<=test; t++) { cin >> a >> b; if(b<0) b = b*(-1); int len = a.length(); rem=0; for(i=0; i<len; i++) { if(a[i]=='-') i=1; rem*=10; rem+=(a[i]-'0'); rem%=b; } if(rem==0) printf("Case %d: divisible\n", t); else printf("Case %d: not divisible\n", t); } }
Friday, October 9, 2015
1214 - Large Division (LightOJ)
Subscribe to:
Post Comments (Atom)
Compare equality of two string in C
#include <stdio.h> #include<string.h> int main() { char* country = "Bangladesh"; char* country2; ...
-
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> using namespac...
-
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<cstring> #include<ve...
-
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> using namespace std; #define pf printf ...
Please explain about this problem..
ReplyDelete