Submission

Status:

PPPPPPPPPP

Score: 100

User: joeKody

Problemset: ความหลากหลาย

Language: c

Time: 0.001 second

Submitted On: 2025-05-21 20:37:55

#include <stdio.h>

int a[100][100];
int main(void){
	int w, l;
	scanf("%d %d", &w, &l);
	for (int i = 0; i < w; i++){
		for (int j = 0; j < l; j++){
			scanf("%d", &a[i][j]);
		}
	}

	int cnt[10];
	int ans = 0;
	for (int i = 0; i < w; i++){
		for (int j = 0; j < l; j++){
			int sum = 0;
			for (int t = 0; t < 10; t++) cnt[t] = 0;
			for (int k = 0; k < 5; k++){
				for (int p = 0; p < 5; p++){
					if (i+k >= w || j+p >= l) sum = -99999;
					cnt[a[i+k][j+p]] = 1;
				}
			}
			for (int t = 0; t < 10; t++) if (cnt[t] != 0) sum++;
			if (sum >= 5) {
				ans++;
			}
		}
	}

	printf("%d", ans);
	return 0;
}