fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int b=0, c;
  8. string a;
  9. cin>>a>>c;
  10. for(int i=0; i<a.size(); i++) {b=b*10+a[i]-48; if(b>c) b=b%c;}
  11. cout<<b<<endl<<a.size();
  12. return 0;
  13. }
Success #stdin #stdout 0s 3476KB
stdin
1550
1224
stdout
326
4