Advertisement
Plabon_dutta

beecrowed 3104

Nov 20th, 2021
913
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. // #include <bits/stdc++.h>
  2. #include<iostream>
  3. #include<cmath>
  4. #include<vector>
  5. #include<string>
  6. #include<algorithm>
  7. #include <iomanip>
  8.  
  9. using namespace std;
  10.  
  11. #define pi acos(-1.0)
  12. #define ll long long int
  13. #define sc scanf
  14. #define pf printf
  15. #define fin for(ll i=0; i<n; i++)
  16. #define fjm for(ll j=0; j<m; j++)
  17. #define fr(i,a,n) for(ll i=a; i<n; i++)
  18. #define rf(i,n,a) for(ll i=n-1; i>=a; i--)
  19. #define pb push_back
  20. #define INF 1e18
  21. #define nl "\n"
  22. #define readfirst() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
  23.  
  24. void OJ() {
  25.     #ifndef ONLINE_JUDGE
  26.     freopen("input.txt","r", stdin);
  27.     freopen("output.txt","w", stdout);
  28.     #endif
  29. }
  30.  
  31. ll gcd(ll p, ll q) {
  32.     return q==0?p:gcd(q,p%q);
  33. }
  34.  
  35. int main() {
  36.     readfirst();
  37.     OJ();
  38.  
  39.     // ll t, n;
  40.     /*cin >> t;
  41.     while(t--) {
  42.         cin >> n;
  43.     }*/
  44.    
  45.     /*while(sc("%lld", &n)!=EOF) {
  46.         // Code Here
  47.        
  48.     }*/
  49.     string str;
  50.     int n;
  51.     cin >> str >> n;
  52.  
  53.     ll ans = 0 , mod = 0;
  54.  
  55.  
  56.     for(int i = 0; i < str.size(); i++){
  57.         ans = mod;
  58.         mod = (((str[i] - '0')+(ans*10)) % n);
  59.     }
  60.     cout << mod << endl;
  61.     return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement