codeforces 555c 数据结构(map 的使用)

该博客介绍了如何解决Codeforces上的555C问题,即在一块n*n的巧克力中,从特定位置开始按照指定方向(上或左)吃掉巧克力,求每次能吃掉多少块。博主分析了问题的关键在于找到从每个点开始能吃到的最远位置,利用Map存储已知位置的信息,并给出了解决方案的代码。
摘要由CSDN通过智能技术生成
Case of Chocolate
time limit per test
3 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Andrewid the Android is a galaxy-known detective. Now he does not investigate any case and is eating chocolate out of boredom.

A bar of chocolate can be presented as an n × n table, where each cell represents one piece of chocolate. The columns of the table are numbered from 1 to n from left to right and the rows are numbered from top to bottom. Let's call the anti-diagonal to be a diagonal that goes the lower left corner to the upper right corner of the table. First Andrewid eats all the pieces lying below the anti-diagonal. Then he performs the following q actions with the remaining triangular part: first, he chooses a piece on the anti-diagonal and either direction 'up' or 'left', and then he begins to eat all the pieces starting from the selected cell, moving in the selected direction until he reaches the already eaten piece or chocolate bar edge.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值