The topic is a bit long and difficult to understand. Look for a long time, also see not very understand, only know the format of input and output. Until I read the last sentence, which is the last word in the output, the meaning of the title is very clear, that is, the pixel at each point of the output is the average of the original four pixels. According to the sample, one is tested, that is, the pixel value of the output point is the average of the value of the original point plus the right, bottom, and bottom right.
Knowing the solution of the problem, it is easy to write the code. (Perhaps I'm not very clear on the above, see the code can be easily understood)
The following is the code for the AC:
#include <iostream> #include <cstdio> #include <cstring>using namespace Std;int main () {//freopen (" Data.txt "," R ", stdin), Char num[10][10];int N, M, I, J;char str[10], Str1[10];while (scanf ("%s ", str)) {if (strcmp (" Endofinput ", str) = = 0) break;scanf ("%d%d ", &n, &m); GetChar (); for (i = 0; i < n; i++) {for (j = 0; J < m; j + +) SC ANF ("%c", &num[i][j]); GetChar ();} scanf ("%s", str1), for (i = 0; i < n-1; i++) {for (j = 0; J < M-1; J + +) printf ("%d", (Num[i][j] + num[i][j + 1] + num [i + 1] [j] + Num[i + 1][j + 1]-4 * ' 0 ')/4);p rintf ("\ n");} return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Hangzhou Electric acm1218--blurred Vision