现在的位置: 首页 > 综合 > 正文

HDU-2009(赛前水题)

2013年07月16日 ⁄ 综合 ⁄ 共 332字 ⁄ 字号 评论关闭

我觉得以后只能有了十分清晰的头脑才能够着手写带代码,,要不然写出来的代码自己改都不知道怎么改正.

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <algorithm>

using namespace std;


int main()
{
	int sta;
	int N;
	while(scanf("%d%d",&sta,&N)!=EOF)
	{
		double sum=sta;
		double flag=sta;
		N--;
		while(N--)
		{
			flag=sqrt(flag);
			sum+=flag;
		}
		printf("%.2lf\n",sum);
	}
	return 0;
}

 

抱歉!评论已关闭.