아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Digital Calculator

시간 제한10초메모리 제한1024 MB

요약
각 테스트 케이스마다 N 팩토리얼의 앞 K자리와 뒤 L자리를 두 문자열로 출력한다.
난이도

보통10점 중 5점

유형
수학, 정수론, 구현
정답자
아직 제출이 없습니다

문제

Dan likes playing with his pocket calculator during those long, boring math classes. Just now the teacher started to talk about the factorial function.

N factorial, denoted by N!, is the product of all the integers between 1 and N, inclusive. For example 6! = 6*5*4*3*2*1 = 720.

Dan took out his calculator out of his pocket to play around with this new function. Unfortunately his calculator quickly ran out of digits and only showed overflow errors. Soon, Dan realized that the factorial function grows very quickly. Still, he would like to know at least some of its digits.

Given three positive integers N, K, L, compute the first K digits and the last L digits of N factorial.

입력

The first line of the input file contains an integer T specifying the number of test cases. Each test case is preceded by a blank line.

Each test case consists of one line containing three positive integers N, K and L separated by single spaces. Neither K nor L will exceed the number of digits in N!.

출력

For each test case output one line containing two strings A and B separated by a single space. Here, A is the string composed of the first K digits of N! and B is the string composed of the last L digits of N!.

제한

  • 1 ≤ T ≤ 101

예제1

  1. 예제 1

    입력
    3
    
    6 2 1
    
    10 3 2
    
    8 5 5
    
    예상 출력
    72 0
    362 00
    40320 40320