1320 Study on unknown species

Source: Internet
Author: User
Description

Scientists have recently discovered an unknown species that has a strong reproductive capacity and will have reproductive capacity from the fourth day of birth, and will breed two new individuals every day. The scientist put a newborn creature in a petri dish, and he wants to know how many of the creature will exist in the petri dish after N days (assuming that the creature will not die during this period ).

Input

The first act is an integer T, indicating the number of data groups.

For each group of test data:

Only one row, one integer n (n <= 100) is the number of days.

Output

For each group of test data to output a row, because the final result is very large, scientists only want to know the value of the last six digits.

Sample Input
2
5
100
Sample output
5
653399

 

Simulate the question and find the rule.

# Include <stdio. h> main () {int number; int N, J; int f [101]; F [1] = f [2] = f [3] = 1; f [4] = 3; for (j = 5; j <= 100; j ++) f [J] = (F [J-1] + F [J-3] * 2) % 1000000; scanf ("% d", & N); For (j = 0; j <n; j ++) {scanf ("% d", & number ); printf ("% d \ n", F [number]) ;}}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.