https://www.luogu.org/problemnew/show/P1051

这个根本就不用排序啊……

#include<bits/stdc++.h>
using namespace std;
#define ll long long int n; struct P{
char name[];
int f;
int c;
char s[];
char w[];
int p;
int idx; int money;
void calc(){
money=;
if(p&&f>)
money+=;
if(f>&&c>)
money+=;
if(f>)
money+=;
if(w[]=='Y'&&f>)
money+=;
if(s[]=='Y'&&c>)
money+=;
} bool operator<(P p){
if(money==p.money)
return idx<p.idx;
else
return money>p.money;
}
}p[]; int main(){
scanf("%d",&n); int sum=;
int maxmoney=-;
int maxi=;
for(int i=;i<n;i++){
scanf("%s%d%d%s%s%d",p[i].name,&p[i].f,&p[i].c,p[i].s,p[i].w,&p[i].p);
p[i].idx=i;
p[i].calc();
sum+=p[i].money;
if(p[i].money>maxmoney){
maxi=i;
maxmoney=p[i].money;
}
}
//sort(p,p+n);
//printf("%s\n%d\n",p[0].name,p[0].money);
printf("%s\n%d\n%d\n",p[maxi].name,p[maxi].money,sum);
}

(水题)洛谷 - P1051 - 谁拿了最多奖学金的更多相关文章

  1. 洛谷—— P1051 谁拿了最多奖学金

    https://www.luogu.org/problem/show?pid=1051 题目描述 某校的惯例是在每学期的期末考试之后发放奖学金.发放的奖学金共有五种,获取的条件各自不同: 1) 院士奖 ...

  2. [NOIP2005] 提高组 洛谷P1051 谁拿了最多奖学金

    题目描述 某校的惯例是在每学期的期末考试之后发放奖学金.发放的奖学金共有五种,获取的条件各自不同: 1) 院士奖学金,每人8000元,期末平均成绩高于80分(>80),并且在本学期内发表1篇或1 ...

  3. 洛谷P1051 谁拿了最多奖学金

    https://www.luogu.org/problem/P1051 #include<bits/stdc++.h> using namespace std; struct node { ...

  4. (Java实现) 洛谷 P1051 谁拿了最多奖学金

    题目描述 某校的惯例是在每学期的期末考试之后发放奖学金.发放的奖学金共有五种,获取的条件各自不同: 院士奖学金,每人8000元,期末平均成绩高于80分(>80),并且在本学期内发表1篇或1篇以上 ...

  5. 2018.10.30 一题 洛谷4660/bzoj1168 [BalticOI 2008]手套——思路!问题转化与抽象!+单调栈

    题目:https://www.luogu.org/problemnew/show/P4660 https://www.lydsy.com/JudgeOnline/problem.php?id=1168 ...

  6. 洛谷 P1583魔法照片 & P1051谁拿了最多奖学金 & P1093奖学金

    题目:https://www.luogu.org/problemnew/show/P1583 思路:sort sort sort //#include<bits/stdc++.h> #in ...

  7. Mychael原创题 洛谷T23923 Mychaelの水题 【题解】

    原题链接 题目大意: 有来自三个地区的人各a,b,c位,他们排成了一排.请问有多少种不同类型的排法,使得相邻的人都来自不同的地区 \(a,b,c<=200\) 答案取模 题解 弱弱的标程解法 设 ...

  8. AC日记——大爷的字符串题 洛谷 P3709

    大爷的字符串题 思路: 莫队,需开O2,不开50: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 20000 ...

  9. P1051 谁拿了最多奖学金——水题

    题目描述 某校的惯例是在每学期的期末考试之后发放奖学金.发放的奖学金共有五种,获取的条件各自不同: 1) 院士奖学金,每人8000元,期末平均成绩高于80分(>80),并且在本学期内发表1篇或1 ...

随机推荐

  1. TCP/IP Protocol Architecture

    原文: https://technet.microsoft.com/en-sg/library/cc958821.aspx 1. 主机到网络层 2.网络互连层(互连这个翻译好) ----------- ...

  2. [Adobe Analytics] Segments types

    There are three types of Segmentation Hit-based Visit-based Visitor-based There are four segment con ...

  3. Mysql学习之十二:JDBC连接数据库之DriverManager方法

    JDBC连接数据库 •创建一个以JDBC连接数据库的程序,包括7个步骤: 1.载入JDBC驱动程序: 在连接数据库之前.首先要载入想要连接的数据库的驱动到JVM(Java虚拟机). 这通过java.l ...

  4. pomelo加入定时任务

    需求:在arenaserver下添加一个rank定时任务,每一分钟对对玩家进行一次排行. 首先在game-server/app/servers/arena文件夹下添加cron文件夹. 在game-se ...

  5. 【iOS】系统框架学习

    iOS的系统架构分为四个层次:核心操作系统层(Core OS layer).核心服务层(Core Services layer).媒体层(Media layer)和可触摸层(Cocoa Touch l ...

  6. GCD编程(封装GCD)

    //GCDGroup 类 @interface GCDGroup : NSObject @property (strong, nonatomic, readonly) dispatch_group_t ...

  7. SQL server 数据库测试题

  8. 翻译:A Tutorial on the Device Tree (Zynq) -- Part III

    A Tutorial on the Device Tree (Zynq) -- Part III 定义外设 可能你读本文是为了给你的设备写一个Linux驱动,在这方面要推荐著名的<Linux D ...

  9. php输出echo、print、print_r、printf、sprintf、var_dump比较

    php输出echo.print.print_r.printf.sprintf.var_dump比较 一.echo    echo() 实际上不是一个函数,是php语句,因此您无需对其使用括号.不过,如 ...

  10. 如何在外部采用AES-128对HLS的TS流进行加密

    http://www.wowza.cn/hls/howToSecureHlsByAes128External