Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // #include <bits/stdc++.h>
- #include<iostream>
- #include<cmath>
- #include<vector>
- #include<string>
- #include<algorithm>
- #include <iomanip>
- using namespace std;
- #define pi acos(-1.0)
- #define ll long long int
- #define sc scanf
- #define pf printf
- #define fin for(ll i=0; i<n; i++)
- #define fjm for(ll j=0; j<m; j++)
- #define fr(i,a,n) for(ll i=a; i<n; i++)
- #define rf(i,n,a) for(ll i=n-1; i>=a; i--)
- #define pb push_back
- #define INF 1e18
- #define nl "\n"
- #define readfirst() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
- void OJ() {
- #ifndef ONLINE_JUDGE
- freopen("input.txt","r", stdin);
- freopen("output.txt","w", stdout);
- #endif
- }
- ll gcd(ll p, ll q) {
- return q==0?p:gcd(q,p%q);
- }
- int main() {
- readfirst();
- OJ();
- // ll t, n;
- /*cin >> t;
- while(t--) {
- cin >> n;
- }*/
- /*while(sc("%lld", &n)!=EOF) {
- // Code Here
- }*/
- string str;
- int n;
- cin >> str >> n;
- ll ans = 0 , mod = 0;
- for(int i = 0; i < str.size(); i++){
- ans = mod;
- mod = (((str[i] - '0')+(ans*10)) % n);
- }
- cout << mod << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement