ZOJ 2857Image Transformation

来源:互联网 发布:javascript闭包是什么 编辑:程序博客网 时间:2024/06/13 00:56

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2857

#include<iostream>#include<string>#include<cmath>#include<cstdio>#include<string.h>#include<cstring>#include<algorithm>using namespace std;int graph[200][200];int main(){    int n, m, cot = 0;    while (cin >> n >> m)    {        cot++;        memset(graph, 0, sizeof graph);        if (n == 0 && m == 0)break;        for (int i = 0; i < 3; i++)        {            for (int j = 0; j < n; j++)            {                for (int k = 0; k < m; k++)                {                    int temp;                    scanf("%d", &temp);                    graph[j][k] += temp;                }            }        }        printf("Case %d:\n", cot);        for (int i = 0; i < n; i++)        {            for (int j = 0; j < m; j++)            {                if (j)printf(",");                printf("%d", graph[i][j] / 3);            }            printf("\n");        }    }    return 0;}
0 0
原创粉丝点击