当前位置:网站首页>PAT1012
PAT1012
2022-08-09 11:09:00 【AlanLiu6】
我算是看明白了,pat无脑暴力就完事了
https://pintia.cn/problem-sets/994805342720868352/problems/994805502658068480
#include<cstdio>
int id[2005],c[2005],math[2005],english[2005],ave[2005];
// 纯暴力
int main()
{
int n,m;
scanf("%d %d",&n,&m);
for(int i = 0;i < n;i++)
{
//int id,c,math,english;
scanf("%d%d%d%d",&id[i],&c[i],&math[i],&english[i]);
ave[i] = (c[i]+math[i]+english[i])/3;
}
for(int i = 0;i< m;i++)
{
int ID;
int T = -1,C,M,E,A;
int flag = 0;
int AB=1,CB=1,MB=1,EB=1;
scanf("%d",&ID);
for(int j = 0;j < n;j++)
{
if(id[j] == ID)
{
flag++;
C = c[j];
M = math[j];
E = english[j];
A = ave[j];
break;
}
}
if(!flag)
{
printf("N/A\n");
continue;
}
for(int j = 0;j < n;j++)
{
if(j == T) continue;
if(c[j] > C) CB++;
if(math[j] > M) MB++;
if(english[j] > E) EB++;
if(ave[j] > A) AB++;
}
// printf("A: %d\n",AB);
if(AB <= CB && AB <= MB && AB <= EB) printf("%d A\n",AB);
else if(CB < AB && CB <= MB && CB <= EB) printf("%d C\n",CB);
else if(MB < CB && MB < AB && MB <= EB) printf("%d M\n",MB);
else if(EB < CB && EB < MB && EB < AB) printf("%d E\n",EB);
}
return 0;
}
边栏推荐
- x86 Exception Handling and Interrupt Mechanism (3) Interrupt Handling Process
- The torch. The stack () official explanation, explanation and example
- Quartz分布式实现
- Netscope: Online visualization tool for neural network structures
- 数论知识点
- 日期工具类
- Missing URI template variable ‘employeeNumber‘ for method parameter of type String
- PTA 实验7-5 输出大写英文字母(10 分)
- 通关SQLilab靶场——Less-1思路步骤
- PTA 求一批整数中出现最多的个位数字
猜你喜欢
ICML 2022 | Out-of-Distribution检测与深最近的邻居
MATLAB中如何把cftool拟合的函数输出到命令行(解决如何导出拟合后的曲线数据)
MATLAB代码实现三次样条插值
Number theory knowledge
性能测试(03)-JDBC Request
C语言统计不同单词数
Cluster understanding
wait system call
信号量SIGCHLD的使用,如何让父进程得知子进程执行结束,如何让父进程区分多个子进程的结束
Preparation for gold three silver four: how to successfully get an Ali offer (experience + interview questions + how to prepare)
随机推荐
UNIX Philosophy
实现strcat函数
Input and output of cnn
百钱买鸡(一)
二叉树 前序是根在前(根左右)中序(左根右)
focusablejs
依赖注入(Dependency Injection)框架是如何实现的
Use gdb to debug multi-process programs, debug parent and child processes at the same time
信号量SIGCHLD的使用,如何让父进程得知子进程执行结束,如何让父进程区分多个子进程的结束
Qt获取EXE可执行文件的上一级目录下的文件
PTA 指定位置输出字符串(c)
Numpy常用操作博客合集
激光条纹中心提取——Steger
OC-块对象
使用.NET简单实现一个Redis的高性能克隆版(四、五)
bit、byte、KB、M、G、T相互关系
golang 三种指针类型具体类型的指针、unsafe.Pointer、uintptr作用
prometheus接入mysqld_exporter
c语言函数的递归调用(汉诺塔问题,楼梯递归问题等)
杂记(6)