您的位置:首页 > 其它

九度oj 1001题 题目很纠结,但是很有意思

2013-09-15 22:02 281 查看
今天开始做九度oj上的题了,觉得还蛮有意思的。也是,因为从今天开始,我决定了一件事情,决定要考研了。本来纠结一个星期的,现在终于想通了,也许现在就应该好好的静下心来好好看书和写程序了。不管怎样,这是自己决定的事。

话说今天在九度oj上做了三道题,感觉蛮好玩的,有些事情是我们在以前编程的时候从来不会考虑到的,比如时时间问题,比如内存问题,我们以前在做程序的时候,从来不考虑这些东西,但是做oj上的题时,不考虑的话就不能ac了。但实际上我现在也没有考虑,多是一些其他的问题导致我不能ac。比如当用到开关flag时,每次在用之前都要先还原一下,否则继续用的话会导致有些测试案例不能ac。还有就是规范问题,总是感觉visual c++的规范好难看啊,如果以现在的用户体验来看待这个问题的话,visual
c++ 6.0编译器简直就是跌倒渣了啊。所以现在改用codeblocks,开源工具。做的蛮好。

下面贴下我在九度oj上的第1001道题目:

题目描述:

This time, you are supposed to find A+B where A and B are two matrices, and then count the number of zero rows and columns.

输入:

The input consists of several test cases, each starts with a pair of positive integers M and N (≤10) which are the number of rows and columns of the matrices, respectively. Then 2*M lines follow, each contains N integers
in [-100, 100], separated by a space. The first M lines correspond to the elements of A and the second M lines to that of B.

The input is terminated by a zero M and that case must NOT be processed.

输出:

For each test case you should output in one line the total number of zero rows and columns of A+B.

样例输入:
2 2
1 1
1 1
-1 -1
10 9
2 3
1 2 3
4 5 6
-1 -2 -3
-4 -5 -6
0


样例输出:
1
5


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: