oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

splithunny Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

splithunny.html

While searching for a spot of something sweet to eat, Winnie-the-Pooh accidentally knocked over a few of his hunny pots. The shattered hunny pots leaked hunny all over his floor. Thankfully, Pooh is well equipped to deal with such situations! He has in his possession several Super Sponges, which are capable of soaking up a pool of hunny, no matter how large. The catch is that each Super Sponge can only soak up a single pool of hunny.

Help Pooh out by counting the number of pools of hunny that are on his floor now, so that he knows how many Super Sponges to use. A pool of hunny is defined by a contiguous region of hunny. Diagonals do not count.

The input will be given as 0 < r, c < 100. The next r lines will each contain c characters. Each character will either be 'H', denoting a spot with hunny in it, or '.', denoting an empty spot.

Output "Oh bother. There are x pools of hunny.", where x is the number of contiguous regions of hunny, disregarding diagonal neighbours. Ignore grammatical mistakes arising from the possibility that x is 1 for a given input case.

Sample Input 1

4 4
H...
.H..
..HH
..HH

Sample Output 1

Oh, bother. There are 3 pools of hunny.

Sample Input 2

3 2
.H
.H
H.

Sample Output 2

Oh, bother. There are 2 pools of hunny.

Tags

Graph Theory

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
110051s32MBAverage
2021s32MBAverage

Judge Compile Command

g++-8 ans.cpp -o splithunny -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.