hdu 4486 Pen Counts
Pen Counts
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 506 Accepted Submission(s): 319
Different rotations of the same pen are the same, however, reflections of a pen may be different (see below).

Each data set consists of a single line of input. It contains the data set number, K, and the length of the roll of fence, N, (3 <= N <= 10000).
1 3
2 11
3 12
4 100
5 9999
2 5
3 4
4 392
5 4165834
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm> using namespace std; int main()
{
int p;
int n;
int num;
int ans;
scanf("%d",&p);
for(int i=;i<p;i++){
ans=;
scanf("%d %d",&num,&n);
for(int a=;a<=n/;a++){
int b1=(n-*a)/+;
int b2=(n-a)/;
int b=max(b1,a);
int c=n-a-b;
if(b==a){
ans--;
}
if(a!=b2&&b2==n-a-b2){
ans--;
}
ans+=(b2-b+)*;
}
printf("%d %d\n",num,ans);
}
return ;
}
hdu 4486 Pen Counts的更多相关文章
- hdu4486 Pen Counts(水题)
Pen Counts Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- hdu 5277 YJC counts stars
hdu 5277 YJC counts stars 题意: 给出一个平面图,n个点,m条边,直线边与直线边之间不相交,求最大团的数目. 限制: 1 <= n <= 1000 思路: 因为平 ...
- hdu 5277 YJC counts stars 暴力
YJC counts stars Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...
- Regionals 2012, North America - Greater NY 解题报告
这套题..除了几何的都出了 完全没时间学几何.杯具 A,B,J 水题不解释 C.Pen Counts 这题的话 写几个不等式限制边得范围就行了 然后枚举最小边 D.Maximum Random Wal ...
- HDU 4648 Magic Pen 6 (。。。。。。。。。。)
Magic Pen 6 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total ...
- hdu 4648 - Magic Pen 6(“水”题)
摘自题解: 题意转化一下就是: 给出一列数a[1]...a[n],求长度最长的一段连续的数,使得这些数的和能被M整除. 分析: 设这列数前i项和为s[i], 则一段连续的数的和 a[i]+a[i+1] ...
- HDU 4648 Magic Pen 6
题目链接 6Y什么水平.. #include <cstdio> #include <cstring> #include <string> #include < ...
- HDU 4648 Magic Pen 6 思路
官方题解: 题意转化一下就是: 给出一列数a[1]...a[n],求长度最长的一段连续的数,使得这些数的和能被M整除. 分析: 设这列数前i项和为s[i], 则一段连续的数的和 a[i]+a[i+1] ...
- HDU 5938 Four Operations(四则运算)
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...
随机推荐
- JavaScript JSON对象(一)
一.JSON数据 JSON(JavaScript Object Notation,JavaScript对象表示法)是一种轻量级的数据交换格式. JSON是“名值对”的集合.结构由大括号'{}',中括号 ...
- git stash命令详解
git stash命令用于将更改储藏在脏工作目录中. 使用语法 git stash list [<options>] git stash show [<stash>] git ...
- 每天一个linux命令:du
1.命令简介 du (Disk usage) 用来计算每个文件的磁盘用量,目录则取总用量. 2.用法 用法:du [选项]... [文件]... 或:du [选项]... --files0-from= ...
- Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test java.lang.IllegalStateException
不能找到对应的带有@SpringBootConfiguration 的类,你需要将它放在包的最顶层.
- 时间mysql
查询一天/今天: select * from table where to_days(column_time) = to_days(now()) select * from table where d ...
- RabbitMQ五种消息队列学习(三)–Work模式
由于在实际应用中,简单队列模型无法解决很多实际问题,而且生产者和消费者是一对一的关系.模型较为单一.故引入Work模式. 结构图 一个生产者.多个消费者. 一个消息只能被一个消费者获取. 测试实现: ...
- utf-8 编码问题
使用下面直接进行处理$str = preg_replace('/[\x{10000}-\x{10FFFF}]/u', '', $str);
- Mac NPM 配置
1.NPM 简介 NPM(node package manager),通常称为 node 包管理器,是目前世界上最大的开源库生态系统.使用 NPM 可以对 node 包进行安装.卸载.更新.查看.搜索 ...
- Git回滚代码到某个commit
回退命令: $ git reset --hard HEAD^ 回退到上个版本$ git reset --hard HEAD~3 回退到前3次提交之前,以此类推,回退到n次提交之前 $ git rese ...
- 记一次spring boot参数初始化的问题
背景:接手一个项目,看到一个配置参数的引用: @Value("${webSocket.id}") 再看看配置application.yml: ... webSocket: id: ...