核反应堆

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 12149    Accepted Submission(s):
5517

Problem Description
某核反应堆有两类事件发生:
高能质点碰击核子时,质点被吸收,放出3个高能质点和1个低能质点;
低能质点碰击核子时,质点被吸收,放出2个高能质点和1个低能质点。
假定开始的时候(0微秒)只有一个高能质点射入核反应堆,每一微秒引起一个事件发生(对于一个事件,当前存在的所有质点都会撞击核子),试确定n微秒时高能质点和低能质点的数目。
 
Input
输入含有一些整数n(0≤n≤33),以微秒为单位,若n为-1表示处理结束。
 
Output
分别输出n微秒时刻高能质点和低能质点的数量,高能质点与低能质点数量之间以逗号空格分隔。每个输出占一行。
 
Sample Input
5
2
-1
 
Sample Output
571, 209
11, 4
提示
可以使用long long int对付GNU C++,使用__int64对付VC6
 
我真是不明白为什么用long long 时输出的低能质点一直是0,换成int64就好了
#include<stdio.h>
#include<string.h>
//#define LL long long
#define MAX 35
__int64 high[MAX],low[MAX];
int n;
int main()
{
int i,j;
low[0]=0;
high[0]=1;
for(i=1;i<MAX;i++)
{
high[i]=high[i-1]*3+low[i-1]*2;
low[i]=low[i-1]+high[i-1];
}
while(scanf("%d",&n)&&n!=-1)
{
printf("%I64d, %I64d\n",high[n],low[n]);
}
return 0;
}

  

hdoj 2085 核反应堆【水】的更多相关文章

  1. HDU 2085 核反应堆 --- 简单递推

    HDU 2085 核反应堆 /* HDU 2085 核反应堆 --- 简单递推 */ #include <cstdio> ; long long a[N], b[N]; //a表示高能质点 ...

  2. hdu 2085 核反应堆

    看完题,想到用结构体存储高质点和低质点,然后打表存储<33的质点数量. #include<stdio.h> struct hilo { long long hi,lo; }; int ...

  3. HDOJ 1070 Milk(水题,考英文的)

    Problem Description Ignatius drinks milk everyday, now he is in the supermarket and he wants to choo ...

  4. HDOJ 5387 Clock 水+模拟

    Clock Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Subm ...

  5. 杭电oj2064、2067、2068、2073、2076-2078、2080、2083-2085

    2064  汉诺塔III #include<stdio.h> int main(){ int n,i; _int64 s[]; while(~scanf("%d",&a ...

  6. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  7. 水题 HDOJ 4727 The Number Off of FFF

    题目传送门 /* 水题:判断前后的差值是否为1,b[i]记录差值,若没有找到,则是第一个出错 */ #include <cstdio> #include <iostream> ...

  8. 水题 HDOJ 4716 A Computer Graphics Problem

    题目传送门 /* 水题:看见x是十的倍数就简单了 */ #include <cstdio> #include <iostream> #include <algorithm ...

  9. HDOJ/HDU 1328 IBM Minus One(水题一个,试试手)

    Problem Description You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or ...

随机推荐

  1. (九)打印机驱动设置—USB接口的设置

    佳博打印机代理商淘宝店https://shop107172033.taobao.com/index.htm?spm=2013.1.w5002-9520741823.2.Sqz8Pf 在此店购买的打印机 ...

  2. 表中查询重复的数据,如何通过sql语句查询?

    1.最直观的思路:要知道所有名字有重复人资料,首先必须知道哪个名字重复了:select name from emp group by name having count(*)>1所有名字重复人的 ...

  3. SQL SERVER 存储过程基础

    一.注释 -- 单行注释,从这到本行结束为注释,类似C++,c#中// /* … */ 多行注释,类似C++,C#中/* … */ 二.变量 (int, smallint, tinyint, deci ...

  4. 【转】 OC基础数据类型-NSSet

    原文 : http://www.cnblogs.com/GISerYang/p/3340937.html 1.集合:集合(NSSet)和数组(NSArray)有相似之处,都是存储不同的对象的地址:不过 ...

  5. C# var

    VAR 是3.5新出的一个定义变量的类型其实也就是弱化类型的定义VAR可代替任何类型编译器会根据上下文来判断你到底是想用什么类型的 至于什么情况下用到VAR 我想就是你无法确定自己将用的是什么类型就可 ...

  6. centos 7 samba相关命令

    1.安装相关包 yum install samba samba-client samba-common 2.启动smb的命令 systemctl enable smb.service systemct ...

  7. 如果数据为null,则转成数据库可识别的DBNULL.Value

    // <summary> /// 如果数据为null,则转成数据库可识别的DBNULL.Value /// </summary> /// <param name=&quo ...

  8. underscorejs-toArray学习

    2.23 toArray 2.23.1 语法: _.toArray(list) 2.23.2 说明: 把list(任何可以迭代的对象)转换成一个数组,在转换arguments对象时非常有用. 2.23 ...

  9. http拦截器interceptors

    在服务里配置$httpProvider.interceptors的相关参数 包含 request请求拦截 response响应拦截 requestError请求错误抛出 responseError响应 ...

  10. 搜索所有的路径-矩阵运算-暴力-ACM

    给定一个n*n整数矩阵,定义对I行的SHIFT操作( 0 <= i < n ),是将第I行所有元素都右移一位,最右边的移到最左边. 你可以对任意行进行任意次SHIFT操作,使得: max0 ...