Title: http://acm.hdu.edu.cn/showproblem.php?pid=2520
I'm a rookie, I'm afraid of WHO
Time limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 7698 Accepted Submission (s): 4505
Problem Descriptionlin2144 is a small rookie, are clumsy birds have, lin2144 want a rookie first fly, he started from 0.
At the beginning of the flight speed of 1m/s, each one unit time lin2144 flight speed than the previous unit time flight speed 2m/s, Q N (0 < n < 10^5) unit time after lin2144 flew how far?
Input a T is expressed as having several sets of data
Each set of data is entered with an n representing the time of the lin2144 flight.
Output lin2144 How far is the flight, because the number is large, so the 10000 modulo.
Sample Input212
Sample Output14
Sourcehdu 2008-10 Programming Contest title to the main idea:, every one unit time flight speed than the previous unit time flight speed 2m/s, so with two arrays, one to record the distance, one to record the speed, so OK. See the code.
1#include <iostream>2#include <cstdio>3 4 using namespacestd;5 6 intnum1[100010],num2[100010];7 8 intMain ()9 {Tennum1[0]=1; Onenum2[0]=0; A for(intI=1; i<100000; i++) - { -Num2[i]= (num1[i-1]+num2[i-1])%10000; thenum1[i]=num1[i-1]+2; - } - intT; -scanf"%d",&t); + while(t--) - { + intN; Ascanf"%d",&n); atprintf ("%d\n", Num2[n]); - - } - return 0; -}
H Question Hdu 2520 I'm a rookie, I'm afraid of WHO