Hangzhou Electric acm1218--blurred Vision

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.