| 比赛 | 
    20120417 | 
    评测结果 | 
    AAATTTTATW | 
    | 题目名称 | 
    矩阵 | 
    最终得分 | 
    40 | 
    | 用户昵称 | 
    TBK | 
    运行时间 | 
    0.000 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    0.00 MiB  | 
    | 提交时间 | 
    2012-04-17 11:08:31 | 
显示代码纯文本
#include <iostream> 
#include <cmath> 
#include <cstring> 
#include <string> 
#include <cstdio> 
#include <cstdlib> 
#include <iomanip> 
#include <set> 
#include <algorithm> 
using namespace std; 
set<int> s;
int a[1000][1000],b,c,d,l,m,n,k,r[36],f[1000][1000];
int main(void) 
{    
    freopen("matrixa.in","r",stdin); 
    freopen("matrixa.out","w",stdout); 
	while (scanf("%d%d",&b,&c)==2)
	{
		for (l=0;l<b;l++)
			for (m=0;m<c;m++)
				scanf("%d",&a[l][m]);
		for (l=0;l<b;l++)
			for (m=0;m<c;m++)
			{
				s.clear();
				for (d=l;d>=0;d--) 
					for (n=m;n>=0;n--)
						s.insert(a[d][n]);
				f[l][m]=s.size();
			}
		for (l=0;l<b;l++)
		{
			for (m=0;m<c;m++) printf("%d ",f[l][m]);
			printf("\n");
		}
	}
    fclose(stdin); 
    fclose(stdout); 
    return 0; 
}