当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
随机推荐
【VIBE: Video Inference for Human Body Pose and Shape Estimation】论文阅读
ICML 2022 | Out-of-Distribution Detection with Deep Nearest Neighbors
golang 三种指针类型具体类型的指针、unsafe.Pointer、uintptr作用
杂记(6)
Solve 1. tensorflow runs using CPU but not GPU 2. GPU version number in tensorflow environment 3. Correspondence between tensorflow and cuda and cudnn versions 4. Check cuda and cudnn versions
实现strcat函数
fork创建多个子进程
Qt 国际化翻译
linux mysql操作的相关命令
x86 Exception Handling and Interrupt Mechanism (3) Interrupt Handling Process
性能测试(04)-表达式和业务关联-JDBC关联
matlab图像分割,从基因芯片荧光图像中提取阴性点(弱)和阳性点(强)
激光条纹中心提取——Steger
无重复字符的最长子串
C语言中信号函数(signal)的使用
从位图到布隆过滤器
Oracle数据库的两种进入方式
margin出bug---margin失效
fork creates multiple child processes
Beauty Values