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

farming Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

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

farming.html

Problem Description

Jiahai loves to eat potatoes. In fact, as you would probably have seen in the previous question, he even has a potato farm dedicated to planting potatoes! It is harvesting day for the Jiahai Potato Farm (JPF) again, and it is time to start picking the potatoes! However, surprisingly, Jiahai does not know how to count the potatoes on his farm! Stumped, he asked you for help in helping him count the number of potatoes he has in his farm.

You will be given a grid of height H and width W. A '#' on the grid will represent a plot with a potato, and a '.' on the grid will represent a plot with no potato. Help Jiahai count the number of potatoes in this grid, which is his farm.

Input

The first line of input will contain two integers, H and W.
The next H lines of input will contain W characters each, providing the grid for Jiahai's potato farm.

Output

Your output should contain one integer, the total number of potatoes found in Jiahai's potato farm.
Your output should terminate with a newline.

Limits

1 <= H <= 500
1 <= W <= 500

Sample Input 1

3 3
.##
#.#
###

Sample Output 1

7

Sample Input 2

4 4
..#.
#...
....
.#.#

Sample Output 2

4

Tags

Syntax

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
1100101s64MBMinimum
2021s64MBMinimum

Judge Compile Command

g++-8 ans.cpp -o farming -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.