Submission #260524

#TimeUsernameProblemLanguageResultExecution timeMemory
260524kingfran1907Emacs (COCI20_emacs)C++14
50 / 50
1 ms384 KiB
#include <bits/stdc++.h>
#define X first
#define Y second

using namespace std;
typedef long long llint;

const int maxn = 110;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 20;
const int off = 1 << logo;
const int treesiz = off << 1;

int n, m;
char niz[maxn][maxn];
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++)
		scanf("%s", niz+i);
		
	int sol = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (niz[i][j] == '*') {
				bool flag = true;
				if (i > 0 && niz[i - 1][j] == '*') flag = false;
				if (j > 0 && niz[i][j - 1] == '*') flag = false;
				sol += flag;
			}
		}
	}
	printf("%d", sol);
	return 0;
}

Compilation message (stderr)

emacs.cpp: In function 'int main()':
emacs.cpp:21:20: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[110]' [-Wformat=]
   scanf("%s", niz+i);
               ~~~~~^
emacs.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~
emacs.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", niz+i);
   ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...