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 ;
}

最新文章

  1. 有状态Bean和无状态Bean的定义
  2. 解决MySQL数据库不允许从远程访问的方法
  3. Ad-Hoc命令不熟悉的选项
  4. Oracle中Kill session的研究(转 出自eagle)
  5. Java中的匿名对象
  6. Java基础之一组有用的类——Observable和Observer对象(Horrific)
  7. js 字符串为空
  8. http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed wit
  9. Android Camera(一)
  10. ecma6的学习好网站
  11. [PHP]实体类基类和序列化__sleep问题
  12. [三]JavaIO之IO体系类整体设计思路 流的概念以及四大基础分类
  13. dataguard从库数据库丢失恢复例子(模拟丢失数据文件)
  14. 学习 Hadoop3.0 一、Hadoop3.0的安装与配置
  15. PhpStorm2016.2版本 安装与破解
  16. 微信小程序点击按钮,修改状态
  17. CNN基础
  18. 分布式时间同步ntp安装
  19. 导入导出SQL数据库
  20. 在Kotlin编写RecyclerView适配器(KAD 16)

热门文章

  1. Object.defineproperty实现数据和视图的联动 ------是不是就是 Angular 模型和视图的同步的实现方式???
  2. NVIDA 提到的 深度框架库
  3. JavaScript------for-in的使用方法
  4. Laravel Cache 使用
  5. shell vim--处理二进制文本
  6. Spring自学教程-IOC、DI、AOP(二)
  7. Sublime Text 2快捷键大全
  8. model first,DB first,code first
  9. ASIHTTPRequest异步请求 分类: ios技术 2015-03-01 09:33 48人阅读 评论(0) 收藏
  10. CentOS6.5安装python redis模块