标签:背景 noip 时间 cst sub 大小 大小写 获得 noi
4
YaoLin 87 82 Y N 0
ChenRuiyi 88 78 N Y 1
LiXin 92 88 N N 0
ZhangQin 83 87 Y N 1
ChenRuiyi
9000
28700
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define N 110 using namespace std; int n,s;char ch; int read() { int x=0,f=1; char ch=getchar(); while(ch<‘0‘||ch>‘9‘){if(ch==‘-‘)f=-1;ch=getchar();} while(ch>=‘0‘&&ch<=‘9‘) x=x*10+ch-‘0‘,ch=getchar(); return x*f; } struct Node { string nime; bool gb,xb; int qm,mj,sum,num; }node[N]; int work(int i,int a,int b,bool x,bool y,int s) { int sum=0; if(a>80&&s>=1) sum+=8000; if(a>85&&b>80) sum+=4000; if(a>90) sum+=2000; if(a>85&&y) sum+=1000; if(b>80&&x) sum+=850; node[i].sum=sum; } int cmp(Node a,Node b) { if(a.sum==b.sum) return a.num<b.num; return a.sum>b.sum; } int main() { n=read(); for(int i=1;i<=n;i++) { cin>>node[i].nime; node[i].qm=read(); node[i].mj=read(); cin>>ch; if(ch==‘Y‘) node[i].gb=1; else node[i].gb=0; cin>>ch; if(ch==‘Y‘) node[i].xb=1; else node[i].xb=0; node[i].sum=read(); node[i].num=i; work(i,node[i].qm,node[i].mj,node[i].gb,node[i].xb,node[i].sum); } sort(node+1,node+1+n,cmp); cout<<node[1].nime; printf("\n%d\n",node[1].sum); for(int i=1;i<=n;i++) s+=node[i].sum; printf("%d",s); return 0; }
标签:背景 noip 时间 cst sub 大小 大小写 获得 noi
原文地址:http://www.cnblogs.com/z360/p/7725318.html