Poj Solution 2305

http://poj.org/problem?id=2305



import java.io.BufferedInputStream;   
import java.math.BigInteger;   
import java.util.Scanner;   
public class Main {   
  
    public static void main(String[] args) {   
        Scanner scan = new Scanner(new BufferedInputStream(System.in));   
        while (scan.hasNext()) {   
            int b = scan.nextInt();   
            if (b == 0) {   
                break;   
            }   
            BigInteger p = scan.nextBigInteger(b);   
            BigInteger m = scan.nextBigInteger(b);   
            System.out.println(p.mod(m).toString(b));   
        }   
    }   
}


											
This entry was posted in poj. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *