POJ 1099 Square Ice 连蒙带猜+根据样例找规律

这篇博客介绍了如何解决POJ 1099 Square Ice问题,这是一个关于二维水分子排列的题目,要求根据交替符号矩阵(ASM)编码来展示方形冰图案。作者通过观察样例输出,确定了输出行数、列数和水分子的分布规律,并提出了构建冰图案的步骤。在处理过程中,作者遇到了理解题意的困难,采用了一种尝试和猜测的方法,最终实现了代码。然而,由于格式问题,代码在开始时未能通过测试。
摘要由CSDN通过智能技术生成

目录

 

题面

思路

思路

AC代码


题面

Square Ice

Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 4526   Accepted: 1759

Description

Square Ice is a two-dimensional arrangement of water molecules H2O, with oxygen at the vertices of a square lattice and one hydrogen atom between each pair of adjacent oxygen atoms. The hydrogen atoms must stick out on the left and right sides but are not allowed to stick out the top or bottom. One 5 x 5 example is shown below. 


Note that each hydrogen atom is attached to exactly one of its neighboring oxygen atoms and each oxygen atom is attached to two of its neighboring hydrogen atoms. (Recall that one water molecule is a unit of one O linked to two H's.) 

It turns out we can encode a square ice pattern with what is known as an alternating sign matrix (ASM): horizontal molecules are encoded as 1, vertical molecules are encoded as -1 and all other molecules are encoded as 0. So, the above pattern would be encoded as: 


An ASM is a square matrix with entries 0, 1 and -1, where the sum of each row and column is 1 and the non-zero entries in each row

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值