#include <iostream>
#include <vector>
#include <cmath>
using namespace std;int exist[100010]={0}, diff[100010] = {0};
// exist记录已经报过的数,diff记录已经报过的数的差值
vector<int> exists;
// exists记录已经报过的数,对于每个新报的数,和每个已存的数相减得差
int ht[15] = {0};
int a[1010][1010];int main() {int n1, n2;scanf("%d%d", &n1, &n2);diff[abs(n1 - n2)] = 1;exist[n1] = 1;exist[n2] = 1;exists.push_back(n1);exists.push_back(n2);int n, m;scanf("%d%d", &n, &m);for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) scanf("%d", &a[i][j]); for(int j = 1; j <= m; j++) {for(int i = 1; i <= n; i++) {if(ht[i] == 1) continue;int t = a[i][j];if(diff[t] && !exist[t]) {for(int i = 0; i < exists.size(); i++) {int t2 = exists[i];diff[abs(t - t2)] = 1;}exist[t] = 1;exists.push_back(t);} else {ht[i] = 1;printf("Round #%d: %d is out.\n", j, i);}}}int f = 1;for(int i = 1; i <= n; i++) {if(ht[i] == 0) {if(f) printf("Winner(s):");printf(" %d", i);f = 0;}}if(f) printf("No winner.");return 0;
}

sad 考完补的 其实就是理顺了考试时候的思路 当时看到通过率才0.02还0.03就慌了觉得自己肯定不行orz(题目看懂却没写出来的估计就我一个白痴了……
测试样例过了,不知实际oj如何……

20200725 PAT甲级 7-2 The Judger (25分)相关推荐

  1. PAT甲级1009 Product of Polynomials (25分)

    PAT甲级1009 Product of Polynomials (25分) 题目: 题目分析:和之前有一道多项式相加很像,注意点是不仅仅数组系数会变,还可能会出现之前没有的指数,因此要开2001大小 ...

  2. 17冬第二题 PAT甲级 1141 Ranking of Institutions (25分) 有点鸡贼

    题目 After each PAT, the PAT Center will announce the ranking of institutions based on their students' ...

  3. PAT甲级 -- 1009 Product of Polynomials (25 分)

    This time, you are supposed to find A×B where A and B are two polynomials. Input Specification: Each ...

  4. PAT甲级-1021 Deepest Root(25分)

    题目:1021 Deepest Root(25分) 分析:找出以某个节点为根时,最深的根,这题可能会超时要用vector来表示二维数组 疑问:代码一是第二次写的超时了,代码二是第一次写的AC了,找不出 ...

  5. PAT甲级--1007 Maximum Subsequence Sum (25 分)

    题目详情 - 1007 Maximum Subsequence Sum (25 分) (pintia.cn) Given a sequence of K integers { N1​, N2​, .. ...

  6. PAT甲级 -- 1007 Maximum Subsequence Sum (25 分)

    Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined to ...

  7. 【PAT甲级】1037 Magic Coupon (25 分) C++ 全部AC

    题目 大意:给出两组数字,找出两组数字的最大乘积和. 思路:先排序,然后分别从头.从尾对应位置相乘,结果相加.直到相乘为负数为止. 题解 C++ #include<iostream> #i ...

  8. 【PAT甲级】1048 Find Coins (25 分) C++ 全部AC

    题目 给你一个sum,以及拥有的钱 让你找出一个组合,正好用两张钱付清sum,注意如果有多个结果,输出其中最小的 这道题注意稍微优化一下算法,要不然卡在测试点3,4 我是用二重循环过了的,只要注意输入 ...

  9. 【PAT甲级 - 1028】List Sorting (25分)(模拟,排序)

    题干: Excel can sort records according to any column. Now you are supposed to imitate this function. I ...

  10. 【PAT - 甲级1024】Palindromic Number (25分)(大数,模拟)

    题干: A number that will be the same when it is written forwards or backwards is known as a Palindromi ...

最新文章

  1. 从复现人类智能到挑战AI大工程,智能计算正经历什么考验?
  2. c#_continue 和 break 的区别
  3. Grub error17:Cannot mount selected partition启动错误的解决
  4. c语言通讯录项目(电话簿)
  5. 带你理解 只读事务(@Transactional(readOnly = true)
  6. 如何用Linux命令行管理网络:11个你必须知道的命令
  7. Atitit 时间的展示格式与存储格式 目录 1.1. 赛事时间的格式起源 1 1.1.1. 六十[编辑] 1 1.2. 1h 12m 23s 模式 (可读性最好 2 1.3. 日常模式 1:45:
  8. java result_Result对象 + 统一异常处理
  9. ai怎么平均排列_一篇AI打麻将的论文,理科生眼中的麻将是这样的
  10. Vivado 2019使用教程
  11. 税盘怎么看服务器是否在维护,税盘服务器地址怎么查
  12. php幂函数,PHP-常用函数
  13. 交流电压电流取样电路
  14. 课程项目:大学程序设计相关大作业汇总参考及源码地址
  15. node抓取王者荣耀英雄资料库
  16. Docker 命令基础及进阶
  17. 最新Hive/Hadoop高频面试点小集合
  18. 任务分配的穷举法、匈牙利法、分支定界法
  19. error: #268: declaration may not appear after executable statement in block
  20. 爬虫-豆瓣书籍排行榜及用户信息-2021.7.23-使用Scrapy框架-用MongoDB存储数据

热门文章

  1. css3 文字高光划过,CSS3实现一束光划过图片、和文字特效
  2. keil5c语言定义引脚,keil编写C程序是不是不能在函数内定义变量啊,求大神
  3. KEIL 5的背景色设置。
  4. 组台式计算机配置清单整套,组装台式电脑配置清单有哪些 台式电脑什么配置好...
  5. 百度网盘下载提速小技巧
  6. NCConverter for mac(NCM音乐格式文件转换器)
  7. L2-036 网红点打卡攻略
  8. python 根据单位名称爬取单位统一社会信用代码
  9. HTML+CSS美食静态网页设计——简单我的家乡吉林
  10. 富瑞和SMBC Group宣布结成战略联盟来推动增长