Triangle

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 336    Accepted Submission(s): 229

Problem Description

Mr. Frog has n sticks, whose lengths are 1,2, 3⋯n respectively. Wallice is a bad man, so he does not want Mr. Frog to form a triangle with three of the sticks here. He decides to steal some sticks! Output the minimal number of sticks he should steal so that Mr. Frog cannot form a triangle with
any three of the remaining sticks.
 

Input

The first line contains only one integer T (T≤20), which indicates the number of test cases.

For each test case, there is only one line describing the given integer n (1≤n≤20).

 

Output

For each test case, output one line “Case #x: y”, where x is the case number (starting from 1), y is the minimal number of sticks Wallice should steal.
 

Sample Input

3
4
5
6
 

Sample Output

Case #1: 1
Case #2: 1
Case #3: 2
 

Source

 
数据较小,打表即可
 //2016.10.08
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std;
int ans[] = {, , , , , , , , , , , , , , , , , , , , };
int main()
{
int T, n, kase = ;
scanf("%d", &T);
while(T--)
{
scanf("%d", &n);
printf("Case #%d: %d\n", ++kase, ans[n]);
} return ;
}

HDU5914的更多相关文章

  1. HDU 5914 Triangle 斐波纳契数列 && 二进制切金条

    HDU5914 题目链接 题意:有n根长度从1到n的木棒,问最少拿走多少根,使得剩下的木棒无论怎样都不能构成三角形. 题解:斐波纳契数列,a+b=c恰好不能构成三角形,暴力就好,推一下也可以. #in ...

随机推荐

  1. typedef和block

    为block类型对象取别名 1.没有使用typedef的情况 int (^block_add)(int, int) = ^(int value1, int value2) { return value ...

  2. losbyday Linux查找命令

    PS:第一次发表博客,试一下水,晚一点修改文本格式 linux下的命令都存放在/bin /sbin /usr/bin /usr/sbin路径下等echo $PATH which 是用来查询命令存放的路 ...

  3. FTP服务器中vsftpd主配置文件解析

    /etc/vsftpd/vsftpd.conf#################匿名权限控制############### anonymous_enable=YES #是否启用匿名用户no_anon_ ...

  4. 十大滤波算法程序大全(Arduino精编无错版)(转)

    源:十大滤波算法程序大全(Arduino精编无错版) 转载请注明出处:极客工坊  http://www.geek-workshop.com/thread-7694-1-1.html

  5. android Makefile把jar包打到apk里

    这个是经常的需求,我就是经常忘,关键不理解啊. 反反复复的也看看了android makefile. 太复杂了. 慢慢来吧.哎.工作十年.啥也不会.咋整? ## Copyright (C) 2008 ...

  6. 现在开始使用 ES6

    ECMAScript已经在2015年6月正式发布了,这门语言一直保持稳定快速的发展而且新功能也在慢慢被现在主流的 JavaScript 引擎所接受.不过要想在浏览器端或者 Node 端直接运行 ES6 ...

  7. smarty3-笔记

    smarty3笔记 1.Samrty.class.php 的compile_dir 和template_dir类属性 是private的,setTemplateDir和setCompileDir类方法 ...

  8. BZOJ 1653 [Usaco2006 Feb]Backward Digit Sums ——搜索

    [题目分析] 劳逸结合好了. 杨辉三角+暴搜. [代码] #include <cstdio> #include <cstring> #include <cmath> ...

  9. 【转】 Vim多行缩进及高级命令

    学习别人的帖子,把内容变成自己的就是成长,此处MARK下 Vim多行缩进技巧 1.按v进入visual状态,选择多行,用>或<缩进或缩出 2. 通常根据语言特征使用自动缩进排版:在命令状态 ...

  10. Tessnet2图片识别(2)

    1. 引用 tessnet2.dll (只有NET2.0版本) 2. 视图页 <%@ Page Language="C#" MasterPageFile="~/Vi ...