早教吧作业答案频道 -->其他-->
一道acm水编程题,ProblemB:CounttherectanglesTimeLimit:1SecMemoryLimit:128MBSubmit:24Solved:7[Submit][Status][WebBoard]DescriptionYouaregivennumbersofrectanglesmadeof'1'sand'0's.Calculatehowmanysmallrectangleswhichhavef
题目详情
一道acm水编程题,
Problem B:Count the rectangles
Time Limit:1 Sec Memory Limit:128 MB
Submit:24 Solved:7
[Submit][Status][Web Board]
Description
You are given numbers of rectangles made of '1's and '0's.Calculate how many small rectangles which have four '1's on the four corners.
Input
There are several test cases,each test case starts with a line containing two positive integers n and m.n and m is the size of the rectangle (1
Problem B:Count the rectangles
Time Limit:1 Sec Memory Limit:128 MB
Submit:24 Solved:7
[Submit][Status][Web Board]
Description
You are given numbers of rectangles made of '1's and '0's.Calculate how many small rectangles which have four '1's on the four corners.
Input
There are several test cases,each test case starts with a line containing two positive integers n and m.n and m is the size of the rectangle (1
▼优质解答
答案和解析
先枚举两行,然后统计一下这两行中对应的例中都是1的个数,然后再用
组合数c(cnt,2)算出这两行中四个角都是1的种数.
总复杂度是n*n*m
组合数c(cnt,2)算出这两行中四个角都是1的种数.
总复杂度是n*n*m
看了一道acm水编程题,Probl...的网友还看了以下:
端午节那天,小丽她妈妈包了一一个粽子,其中7个放了大枣,小丽随意拿了一个,那么,他拿她粽子有大枣她 2020-04-06 …
十分之七加三分之一= 16分之五-8分之一= 3分之一-7分之2= 1+4分之一= 12分十分之七 2020-05-14 …
根据所给算式判断△与☆的大小△十8=☆十7☆一8二△一7△x8二☆×7 2020-05-17 …
火柴棍游戏只移动一根7十7=7一7 2020-06-27 …
甩响鞭,摇铃铛,去放牧,九只羊猜三个数字,>>>财富热线:1一8一6一1一0一8一8一6一7一7一 2020-07-04 …
怎么解释小镰刀,舞起来,大丰收,碰酒杯猜三个独胆,是什么意思>>>财富热线:1一8一6一8一0一4 2020-07-04 …
(一3.59)×(一7/22)一2.41×(一7/22)+6×(一7/22)要过程, 2020-07-17 …
脱式计算(有简的就简便)3.3×3/4+0.75×5.7+75%(2/3+1/2)×6/7一5脱式 2020-07-17 …
一7多位数,亿位是一位数中最大的奇数,千万位是最大的合数,十万位是最小的合数,万位是最小的质数,其 2020-07-31 …
直接写出得数:7-w.w7=w×w.899=4×w.9×w.w=w.w÷w.2w÷4=87+w.一= 2020-10-31 …