HDU5914
2024-09-01 02:13:35
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.
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 ;
}
最新文章
- 有状态Bean和无状态Bean的定义
- 解决MySQL数据库不允许从远程访问的方法
- Ad-Hoc命令不熟悉的选项
- Oracle中Kill session的研究(转 出自eagle)
- Java中的匿名对象
- Java基础之一组有用的类——Observable和Observer对象(Horrific)
- js 字符串为空
- http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed wit
- Android Camera(一)
- ecma6的学习好网站
- [PHP]实体类基类和序列化__sleep问题
- [三]JavaIO之IO体系类整体设计思路 流的概念以及四大基础分类
- dataguard从库数据库丢失恢复例子(模拟丢失数据文件)
- 学习 Hadoop3.0 一、Hadoop3.0的安装与配置
- PhpStorm2016.2版本 安装与破解
- 微信小程序点击按钮,修改状态
- CNN基础
- 分布式时间同步ntp安装
- 导入导出SQL数据库
- 在Kotlin编写RecyclerView适配器(KAD 16)
热门文章
- Object.defineproperty实现数据和视图的联动 ------是不是就是 Angular 模型和视图的同步的实现方式???
- NVIDA 提到的 深度框架库
- JavaScript------for-in的使用方法
- Laravel Cache 使用
- shell vim--处理二进制文本
- Spring自学教程-IOC、DI、AOP(二)
- Sublime Text 2快捷键大全
- model first,DB first,code first
- ASIHTTPRequest异步请求 分类: ios技术 2015-03-01 09:33 48人阅读 评论(0) 收藏
- CentOS6.5安装python redis模块