码迷,mamicode.com
首页 > 其他好文 > 详细

杭电OJ -- 2085 核反应堆

时间:2015-09-27 10:02:37      阅读:349      评论:0      收藏:0      [点我收藏+]

标签:

#include <iostream>
using namespace std;

int main()
{
	int n;
	int sec;
	while (cin >> n && n != -1)
	{
		//cin >> sec; //输入多少秒
		__int64 sum_of_high = 1;
		__int64 sum_of_low = 0;
		__int64 high_temp = sum_of_high;
		__int64 low_temp = sum_of_low;

		for (int i = 1; i <= n; ++i)
		{
			sum_of_high = 3 * high_temp + 2 * low_temp;
			sum_of_low = high_temp + low_temp;
			high_temp = sum_of_high;
			low_temp = sum_of_low;
		}
		cout << sum_of_high << ", " << sum_of_low << endl;
	}
	return 0;
}

  

杭电OJ -- 2085 核反应堆

标签:

原文地址:http://www.cnblogs.com/lishuhuakai/p/4841820.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!