NOIP Informatics Olympiad Download
Time limit: 1000 ms Memory Limit: 65536 KB
Submissions: 14804 Number by: 10535
[title] Description
of existing x billion people, according to an annual growth rate of 0.1%, n how many years will people ? We reserved four decimal places.
[] Input
line, comprising two integers x and n, respectively, and the number of years the population base, separated by a single space.
[Output]
output last population, of millions of units, reserved to four decimal places. 1≤x≤100,1≤n≤100.
[Input] Sample
13 10
[output] Sample
13.1306
[Source]
NO
代码如下:
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
double x,n;
int i;
cin>>x>>n;
for(i=1;i<=n;i++)//按年循环
x=x*1.001;//计算
printf("%.4lf\n",x);
return 0;
}