hdu 1212(数学)

/*

  Name: 数学题 

  Author: Try_86

  Date: 10/04/12 20:56

*/



#include <cstdio>

#include <cstring>

#include <iostream>



using namespace std;



int b;

char a[1005];



int solve() {

    int ans = 0;

    for (int i=0; a[i]; ++i) ans = (ans * 10 + a[i] - '0') % b;

    return ans;    

}



int main() {

    while (scanf("%s%d", a, &b) != EOF) {

        int ans = solve();

        printf ("%d\n", ans);

    }

    return 0;

}

 

你可能感兴趣的:(HDU)