首页 > 其他 > 详细

[ZOJ 4014] Pretty Matrix

时间:2019-04-27 21:38:36      阅读:172      评论:0      收藏:0      [点我收藏+]

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

AC代码:

/*
 * 反思:
 * 1.遇到简单题别激动,先把它所有的输入任务都完成了,在考虑处理的问题
 * 2.当你的程序没有按回车就全部运行完的时候,这段程序十有八九是有问题的,
 * 仔细检查是不是输入没输入全,或者特殊字符没处理或者运行过程中遇到问题了。
 */

#include <cstdio>

using namespace std;

int test;
int n, m, a, b;
int x, sum, cnt;

int main() {
    scanf("%d", &test);
    while (test--) {
        scanf("%d%d%d%d", &n, &m, &a, &b);
        sum = n * m;
        if (a > b) {
            while (sum--) {
                scanf("%d", &x);
            }
            printf("No Solution\n");
        } else {
            cnt = 0;
            while (sum--) {
                scanf("%d", &x);
                if (x < a || x > b) {
                    cnt++;
                }
            }
            printf("%d\n", cnt);
        }
    }
    return 0;
}

[ZOJ 4014] Pretty Matrix

原文:https://www.cnblogs.com/youpeng/p/10780219.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!