Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std; char mat[2005][2500]; int main(){ int n, m, k; cin >> n >> m >> k; for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { cin >> mat[i][j]; } } long long result = 0; for(int i = 0; i < n; i++) { int consecutive = 0; for(int j = 0; j < m; j++) { if(mat[i][j] == '.') { consecutive++; } if(mat[i][j] == '*' or j == m - 1) { result += max(0, consecutive - k + 1); consecutive = 0; } } } if(k != 1) { for(int i = 0; i < m; i++) { int consecutive = 0; for(int j = 0; j < n; j++) { if(mat[j][i] == '.') { consecutive++; } if(mat[j][i] == '*' or j == n - 1) { result += max(0, consecutive - k + 1); consecutive = 0; } } } } cout << result << endl; return 0; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)