2016"百度之星" - 资格赛(Astar Round1) Problem B
规律题,斐波那契数列,数据有毒,0的时候输出换行。会爆longlong,写个大数模板或者Java搞。
import java.io.BufferedInputStream;
import java.math.BigInteger;
import java.util.Scanner; public class Main { public static void main(String[] args) {
Scanner sc = new Scanner (new BufferedInputStream(System.in)); BigInteger[] fib=new BigInteger [300];
fib[0]=BigInteger.ZERO;
fib[1]=BigInteger.ONE;
for(int i=2;i<=201;i++)
{
fib[i]=fib[i-1].add(fib[i-2]);
} while (sc.hasNext()){
int n = sc.nextInt();
if(n==0)
{
System.out.println();
}
else System.out.println(fib[n+1].toString());
}
}
}
2016"百度之星" - 资格赛(Astar Round1) Problem B的更多相关文章
- HDU 5688:2016"百度之星" - 资格赛 Problem D
原文链接:https://www.dreamwings.cn/hdu5688/2650.html Problem D Time Limit: 2000/1000 MS (Java/Others) ...
- HDU 5686:2016"百度之星" - 资格赛 Problem B
原文链接:https://www.dreamwings.cn/hdu5686/2645.html Problem B Time Limit: 2000/1000 MS (Java/Others) ...
- HDU 5685:2016"百度之星" - 资格赛 Problem A
原文链接:https://www.dreamwings.cn/hdu5685/2637.html Problem A Time Limit: 2000/1000 MS (Java/Others) ...
- 2016百度之星 资格赛ABCDE
看题:http://bestcoder.hdu.edu.cn/contests/contest_show.php?cid=690 交题:http://acm.hdu.edu.cn/search.php ...
- 2016"百度之星" - 资格赛(Astar Round1) Problem E
简单模拟题,耐心写就能过. #include <stdio.h> #include <math.h> #include<cstring> #include<c ...
- 2016"百度之星" - 资格赛(Astar Round1) Problem C
字典树. 插入的时候update一下节点出现的次数. delete的时候,先把前缀之后的全删了.然后看前缀最后一个节点出现了几次,然后前缀上每个节点的次数都减去这个次数. 前缀从上到下再检查一遍,如果 ...
- 2016"百度之星" - 资格赛(Astar Round1) Problem D
排个序,map直接搞. #include <stdio.h> #include <math.h> #include<cstring> #include<cma ...
- 2016"百度之星" - 资格赛(Astar Round1) Problem A
保存前缀乘,询问的时候输出c[ri]/c[li-1]即可,因为是除法,所以计算一下c[li-1]的逆元. #include <stdio.h> #include <math.h> ...
- 2016"百度之星" - 资格赛(Astar Round1)
逆元 1001 Problem A 求前缀哈希和逆元 #include <bits/stdc++.h> typedef long long ll; const int MOD = 9973 ...
随机推荐
- Ansible5:常用模块【转】
根据zs官方的分类,将模块按功能分类为:云模块.命令模块.数据库模块.文件模块.资产模块.消息模块.监控模块.网络模块.通知模块.包管理模块.源码控制模块.系统模块.单元模块.web设施模块.wind ...
- ubuntu 自动获取ip的怎么设置
ubuntu以DHCP方式配置网卡自动获取ip编辑文件/etc/network/interfaces:sudo vi /etc/network/interfaces并用下面的行来替换有关eth0的行: ...
- mongodb分片认证
启动configsvr 1. 确保mongdb的configsvr是采用service模式启动的,即从/etc/init.d下的脚本启动的,其用户是mongod. 2. 确保mongod的配置文件完全 ...
- Photoshop 钢笔 双窗口显示
钢笔:两点成一线 两点:Photoshop 叫锚点 中间线叫做路径 路径变选区 Crtl+Enter 窗口 >>>排列>>> 双联垂直 两个文件同时移动: shi ...
- 直接用request.setAttribute()会报错,在这之前应该先让request获取ServletActionContext.getRequest();方法 // request.getAttribute同理
正确流程应该是 import javax.servlet.http.HttpServletRequest; HttpServletRequst request = ServletActionConte ...
- C#后台绑定ComboBox
C# using System; using System.Collections.Generic; using System.Linq; using System.Text; using Syste ...
- C#生成DLL文件
使用csc命令将.cs文件编译成.dll的过程 很多时候,我们需要将.cs文件单独编译成.dll文件, 操作如下: 打开命令窗口->输入cmd到控制台->cd C:\WINDOWS\Mic ...
- Android中布局文件中使用onClick属性
安卓开发中,布局文件中的控件有一个属性,是onClick,例如: <Button android:id="@+id/button1" ...
- 函数FindFirstFile
文件查找 Struct Lnode{ Char table[256]; //保存文件夹名 Struct Lnode*next; } 加文件夹入链表 Lnode *newList; Vo ...
- 转博客至github
呃呃呃,当初是从新浪博客转过来的,现在发现github的静态博客对我来说用起来更方便. 转至github,这里的东西以后有空会一点一点移过去. http://jcf94.github.io