POJ 2900 Griddy Hobby

数据挖掘实战:决策树 + 聚类 + 关联规则,零 Key 离线可跑(Python 源码) 数据挖掘实战包。用 Python 标准库实现 CART 风格决策树、K-Means 聚类与 Apriori 关联规则,在虚构「星河便利店」会员表和购物篮上跑通分类、分群与购物篮分析,并给出准确率、轮廓系数、支持度/置信度/提升度。零第三方依赖、零 API Key 即可离线跑通。含 4 个样例、离线冒烟、中文 README(含「使用方法」)。均为作者原创可运行源码。MIT。作者 blog.youkuaiyun.com/mtl1994 立即下载

Griddy Hobby
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 414 Accepted: 146

Description

Attending a boring weekly session, our professor started drawing on a grid in a page of his calendar. He started at a boundary grid point P; note that P is a corner of one or two grid cells. He drew a diameter of one of those cells and continued on a straight line until reaching point Q on another edge of the grid. Then he started another line from Q, perpendicular to the line PQ until hitting another edge at point R. He kept drawing lines as above, until he could not draw a new line, either because a perpendicular line would not start with a cell diameter or it would fall on an already drawn line. Then he was puzzling how he would be able to count the number of minimal rectangles he has created on the grid. At this time, the chair of the session noticed him and asked him what he was doing. "Sorry, I was designing a problem for the ACM-ICPC Tehran site," he said.

You are to write a program to, given the dimensions R and C of a grid, the coordinates x and y of a point P on one of the edges of the grid, and the direction (up, left), (down, left), (up, right), or (down, right) of the first line, help the professor to find out the number of minimal rectangles.

Input

The input file contains multiple test cases. The first line of the input, contains t, the number of test cases that follow. Each of the following t blocks, describes a test case.

The first line of each block, contains two positive integers R and C, which are the number of horizontal and vertical gridlines, respectively (2 <= R,C <= 1000). The coordinates of the starting point comes on the next line, as two positive integers y and x, (1 <= y <= R, 1 <= x <= C ); for the upper-left point of the grid, we have x = y = 1. The third line of each test case, contains a two-character code which is one of the following:
  • "DR", the first move is in the down-right direction,
  • "DL", the first move is in the down-left direction,
  • "UL", the first move is in the up-left direction,
  • "UR", the first move is in the up-right direction.

Output

For each test case, output one line containing the number of non-overlapping rectangles formed.

Sample Input

2
4 5
2 1
DR
4 5
4 1
UR

Sample Output

1
3

Source

 

/*

Keep fighting.

计算几何题,仔细思考不难发现,所有直线交点(转折点除外,即反射点),所有当前

新生成的直线与其相邻直线外所有直线交点的个数和即为所求,所以在模拟过程中可以

存储所有的直线当处理某一条直线时,只需遍历所有已经生成的直线(其相邻直线除外)

统计交点个数即可。终止条件的判断用了个技巧,每个点都有1,2,3,4四个方向,如果

有哪个点的方向被重复或者到底矩形的四个顶点则访问终止

*/

 

 

 

产业园区如何高效对接企业技术需求与高校科研成果?.docx 科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。 立即下载

相关推荐

国央企创新负责人如何快速掌握本地科技资源分布与匹配情况?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

POJ 2098 Ellipse 笔记

给出椭圆(椭圆的轴可能不是垂直的或水平的)上五个点的坐标,求椭圆面积。 

woniupengpeng的专栏 348

国央企创新负责人如何实现科技成果的精准识别与高效筛选?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

POJ 2036 I Conduit! 笔记

n段线段,给出线段的端点坐标。重新绘制最少需画多少线段。

woniupengpeng的专栏 360

11、rsa-目标主机支持RSA密钥交换【原理扫描】的漏洞

通过将 etcd 的 TLS 密钥交换算法从 RSA 升级为 ECDHE,可实现前向保密,彻底消除 “私钥泄露导致历史流量解密” 的风险。核心步骤是通过强制启用含ECDHE的套件,并禁用 RSA 密钥交换套件,同时建议升级到 TLS 1.2+ 并优化证书类型(优先 ECDSA)。这一配置符合云原生安全最佳实践,也是 Kubernetes 等依赖 etcd 的系统推荐的安全标准。生成临时密钥的具体步骤是什么?如何验证etcd是否已成功更新为ECDH密钥交换算法?配置临时密钥交换算法可能带来哪些性能影响。

xuebo1129927648的博客 1万+

别再只放按钮了!巧用微信小程序‘长按识别’功能,打造无缝加群体验

本文深入探讨了微信小程序'长按识别'功能在社群运营中的创新应用,通过简化加群流程至一步操作,显著提升用户转化率。文章详细解析了技术实现细节、UI/UX设计策略,并对比了与企业微信API的适用场景,为开发者提供打造无缝加群体验的完整解决方案。

weixin_42627853的博客 434

POJ 刷题顺序

POJ从简到难(按照AC数目排序)的列表如下,作为小弱的刷题

thestoryofsnow的专栏 31万+

微信小程序 - {“errMsg”:”requestPayment:fail banned”} 微信小程序调用wx.requestPayment支付失败返回错误(uniapp微信小程序微信支付报错)

{“errMsg”:”requestPayment:fail banned”},微信小程序调用wx.requestPayment报错requestPayment:fail banned,uni-app微信小程序wx.requestPayment支付报错requestPayment:fail banned,拉起小程序支付报错,iPhone苹果ios真机微信支付报错,Android安卓手机微信支付报错,支付报错,商户配置,签名验证,uniapp 小程序支付微信支付一场,设置过b2b类目,确认了商户号相关功能正常

🏆 前端领域优质创作者 3344

poj完整分类

DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  1024   Calendar Game       简单题  1027   Human Gene Functions   简单题  1037   Gridland            简单题  1052   Algernon s Noxious

zhongkeli的专栏 7874

20 Embedding 与向量检索:语义为什么能变成距离

Embedding 是 RAG 语义检索的数学基础。本文用工程视角讲清文本如何变成向量,为什么语义相近会表现为距离相近,Top-K 检索如何工作,以及在模型选择、同模型约束、精确匹配和召回评估上的常见坑。

老于的笔记的专栏 6204

Langchain cannot connect with Azure SQL Database

Langchain 无法连接到 Azure SQL 数据库

suiusoar 633

POJ 1127 Jack Straws

 Jack StrawsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1824 Accepted: 817DescriptionIn the game of Jack Straws, a number of plastic or wooden "st

bobten2008的专栏 2178

学Simulink——基于风力发电系统的建模与仿真场景:基于自适应控制的风力发电系统输出功率调节

本文详细介绍了使用Simulink搭建风力发电系统自适应控制模型的完整流程。首先阐述了风速波动对电网的影响及自适应控制的优势,然后逐步指导创建Simulink项目、搭建系统结构(包括风速源、风轮机、发电机等模块),重点讲解了模型参考自适应控制器(MRAC)的设计步骤和参数设置方法。通过仿真分析验证了系统在风速变化时仍能保持输出功率稳定,展示了自适应控制的响应速度和鲁棒性。最后提出了引入深度学习预测、多变量控制等优化方向,为新能源领域工程师提供了实用的建模与仿真指导。

amy_mhd的博客 220

POJ 2079 Triangle

 TriangleTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 4224 Accepted: 1149DescriptionGiven n distinct points on a plane, your task is to find the tr

bobten2008的专栏 2084

安卓手机老版本微信无法登录?无需root 一招教你如何搞定!旧版本照样登录,微信7.0亲测有效

微信我试了清缓存、用不同的版本、甚至关网登录都不行。于是我研究了一下背后的原理,发现这不仅是个技巧,还是微信设计的一点“疏忽”——**只要有方法,旧版本照样能用**。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 1万+

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

POJ 2074 Line of Sight

 Line of SightTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1406 Accepted: 423DescriptionAn architect is very proud of his new home and wants to be

bobten2008的专栏 1732

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

POJ 1673 EXOCENTER OF A TRIANGLE

 EXOCENTER OF A TRIANGLETime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1853 Accepted: 682DescriptionGiven a triangle ABC, the Extriangles of ABC are co

bobten2008的专栏 1307

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

POJ 2036 I Conduit!

 I Conduit!Time Limit: 2000MS Memory Limit: 30000KTotal Submissions: 1313 Accepted: 245DescriptionIrv Kenneth Diggit works for a company that excavates trenches

bobten2008的专栏 1293

POJ 1244 Slots of Fun

 Slots of FunTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 748 Accepted: 441DescriptionThe International Betting Machine company has just issued a n

bobten2008的专栏 1017

POJ 1899 Farmer Bill's Problem

 Farmer Bills ProblemTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2159 Accepted: 514DescriptionIt is rumored that the planet Earth is often visited

bobten2008的专栏 994

POJ 1675 Happy Birthday

 Happy Birthday!Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 3352 Accepted: 791DescriptionThere are three berries on a round birthday cake. You a

bobten2008的专栏 960

POJ 1113 WALL

 WallTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 13254 Accepted: 4217DescriptionOnce upon a time there was a greedy King who ordered his chief Arc

bobten2008的专栏 949

POJ 1873 The Fortified Forest

The Fortified ForestTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1894 Accepted: 561DescriptionOnce upon a time, in a faraway land, there lived a king.

bobten2008的专栏 897

POJ 1696 Space Ant

 Space AntTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 834 Accepted: 542DescriptionThe most exciting space discovery occurred at the end of the 20t

bobten2008的专栏 755
上一篇: 怎样写一个拼写检查器 Peter Norvig 翻译: Eric You XU
下一篇: POJ 2901 Hotel
bobten2008
博客等级 码龄18年 153粉丝 157原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值