Openjudge1.5答案(16-25题)

C语言编程实例:基础算法与数学应用

目录

16

17

18

19

20

21

22

23

24

25


16

#include <stdio.h>
#include<math.h>
int main()
{
	int n,k;
	scanf("%d %d",&n,&k);
	int year,posses;
	double price=200*1.0;
	for(year=1;year<21;year++)
	{
		posses=n*year;
		if(posses>=price)
		{
			printf("%d",year);
			return 0;
		}
		price*=(1+(k*1.0)/100);
	}
	printf("Impossible");
}

17

#include <stdio.h>
#include<math.h>
int main()
{
	int n;
	scanf("%d",&n);
	int a[n];
	a[0]=1;
	a[1]=1;
	int i;
	for(i=2;i<n;i++)
	{
		a[i]=a[i-1]+a[i-2];
	}
	printf("%d",a[i-1]);
}

18

#include <stdio.h>
#include<math.h>
int main()
{
	int n,i;
	scanf("%d",&n);
	int a,b,s[n-1][2];
	double x,y[n-1];
	scanf("%d %d",&a,&b);
	x=(b*1.0)/a;
	for(i=0;i<n-1;i++)
	{  
		scanf("%d %d",&s[i][0],&s[i][1]);
		y[i]=(s[i][1]*1.0)/s[i][0];
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值