3 条题解
-
2蔡泽桦 (caizehua) LV 8 @ 2022-3-13 12:39:00
#include<iostream> #include<cstdlib> #include<cstdio> #include<cmath> #include<algorithm> using namespace std; struct stu{ string name; int end,bj,write; char cl,west; int ss; }a[361]; int n,cnt=0; void bubble(){ bool flag; for(int i=1;i<=n;i++){ flag = true; for(int j=i;j<=n;j++){ if(a[j].ss>a[i].ss){ swap(a[i],a[j]); flag = false; } } if(flag){ return ; } } } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].name; cin>>a[i].end>>a[i].bj; cin>>a[i].cl>>a[i].west>>a[i].write; if(a[i].end>80&&a[i].write>=1){ a[i].ss += 8000; } if(a[i].end>85&&a[i].bj>80){ a[i].ss += 4000; } if(a[i].end>90){ a[i].ss += 2000; } if(a[i].end>85&&a[i].west=='Y'){ a[i].ss += 1000; } if(a[i].bj>80&&a[i].cl=='Y'){ a[i].ss += 850; } cnt += a[i].ss; } bubble(); cout<<a[1].name<<endl; cout<<a[1].ss<<endl; cout<<cnt; return 0; }
-
02022-5-11 10:53:28@
建议直接用最大值,用结构体有点繁琐
-
02022-5-11 10:52:32@
#include<bits/stdc++.h>
using namespace std;
char a[100][1000];
int main(){
char c1,c2; int n,ans=0,max=INT_MIN,score1,score2,num,k; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%s %d %d %c %c %d",&a[i],&score1,&score2,&c1,&c2,&num); int temp=0; if(score1>80&&num>0){ temp+=8000; } if(score1>85&&score2>80){ temp+=4000; } if(score1>90){ temp+=2000; } if(c2=='Y'&&score1>85){ temp+=1000; } if(c1=='Y'&&score2>80){ temp+=850; } ans+=temp; if(temp>max){ max=temp; k=i; } } printf("%s\n%d\n%d\n",a[k],max,ans); return 0;
}
- 1
信息
- ID
- 680
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- 递交数
- 149
- 已通过
- 65
- 上传者