Submission #260524

# Submission time Handle Problem Language Result Execution time Memory
260524 2020-08-10T12:57:10 Z kingfran1907 Emacs (COCI20_emacs) C++14
50 / 50
1 ms 384 KB
#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

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 time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct