Submission #440603

# Submission time Handle Problem Language Result Execution time Memory
440603 2021-07-02T14:04:06 Z RaadSharar777 Emacs (COCI20_emacs) C++17
Compilation error
0 ms 0 KB
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<utility>
using namespace std;
int main(){
	int n,m;
	scanf
	char grid[n+2][m+2];
	memset(grid,0,sizeof grid);
	for (int i = 1; i <= n; i++) {
		string k;
		cin >> k;
		for (int j = 1; j <= m; j++){
			grid[i][j] = k[j-1];
		}
	}
	int sum = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			if(grid[i][j] == '*' && grid[i-1][j]!= '*' && grid[i][j-1]!= '*' && grid[i-1][j-1]!= '*')
			sum++;
		}
	}
	cout << sum << endl;
}

Compilation message

emacs.cpp: In function 'int main()':
emacs.cpp:12:7: error: expected ';' before 'char'
   12 |  scanf
      |       ^
      |       ;
   13 |  char grid[n+2][m+2];
      |  ~~~~  
emacs.cpp:12:2: warning: statement is a reference, not call, to function 'scanf' [-Waddress]
   12 |  scanf
      |  ^~~~~
emacs.cpp:12:2: warning: statement has no effect [-Wunused-value]
emacs.cpp:14:9: error: 'grid' was not declared in this scope
   14 |  memset(grid,0,sizeof grid);
      |         ^~~~