Numbers (Small)
Time limit5sMemory limit512 MB
Given small n up to 30, print the last three digits of the integer part of (3 + sqrt(5))^n, formatted as Case #X: Y.
- Level
Medium4 of 10
- Topics
- Math, Number theory, Implementation
- Solved
- No attempts yet
Problem
For a positive integer , find the last three digits before the decimal point of .
For example, if then , so the answer is 935. If then , so the answer is 027.
Input
The first line contains the number of test cases . Each of the next lines contains one positive integer .
Limits
Output
For each test case, print one line in the following format.
Case #X: Y
Here is the number of the test case and is the last three digits of the integer part of . If the integer part has fewer than three digits, pad it with leading zeros so that the output has exactly three digits.