POJ 3100 Root of the Problem || 1004 Financial Management 洪水!!!

水两发去建模,晚饭吃跟没吃似的,吃完没感觉啊。


---------------------------分割线”水过。。。。。“-------------------------------

POJ 3100 Root of the Problem

http://poj.org/problem?id=3100

大意:

给定B和N,求一个数A使得A^N最接近B

太水了。。。。。

#include<cstdio>
#include<cmath>
int main()
{
	double B,N;
	while(scanf("%lf%lf",&B,&N),B||N)
	{
		double a1=floor(pow(B,1.0/N));
		double a2=a1+1;

		if(fabs(pow(a1,N)-B )> fabs(pow (a2,N)-B))
			printf("%.0lf\n",a2);
		else 
			printf("%.0lf\n",a1);
		
	}
}


1004 Financial Management

http://poj.org/problem?id=1004

大意:给定12个数,求他们平均值。。。。。。。。

#include<cstdio>
int main()
{
	double temp,sum=0;
	for(int i=0;i<12;i++)
	{
			scanf("%lf",&temp);
			sum+=temp;
	}
	printf("$%.2lf\n",sum/12);
}



posted @ 2013-11-16 18:26  hr_whisper  阅读(143)  评论(0)    收藏  举报