[Login|Register]
Problems

Status

Rank

Problem 1265
Factorial Problem
Time Limit: 3000ms
Memory Limit: 65536kb
Description
Now, you are given three positive A, B, C, your task is to compute the first B digits and the last C digits of the factorial of A.
For example A=5, B=2, C=1. Then A! =120, so you should output 12 0 separated by one blank.
Input
The first line, an integer T, representing T test cases below. (T<=200).
Each test case contains three integers: A (1<=A<=10^8), B (1<=B<=50) and C (1<=C<=100).
Notice: No illegal case is permitted. For example, the condition A=4, B=10, C=10 is not permitted in the input data.
Output
For each case, output the first B digits and the last C digits of the factorial of A separated by one blank.
Sample Input
2
5 2 1
8 2 2
Sample Output
12 0
40 20
University of Science and Technology of China
Online Judge for ACM/ICPC
Processed in 0.8ms with 1 query(s).