目录
$Luogu\ P1051$ 谁拿了最多奖学金$(\ √\ )$
$Luogu\ P1052$ 过河( )
$Luogu\ P1053$ 篝火晚会( )
$Luogu\ P1054$ 等价表达式( )
$Luogu\ P1051$ 谁拿了最多奖学金
大水题,直接按题意模拟判断即可
1 #include<bits/stdc++.h> 2 using namespace std; 3 struct Student{ 4 string name; 5 int s1,s2,p; 6 bool west,ganbu; 7 }student[103]; 8 int num,maxn=0,sum=0; 9 void count(int x){ 10 int ans=0; 11 if(student[x].s1>80&&student[x].p>=1) ans+=8000; 12 if(student[x].s1>85&&student[x].s2>80) ans+=4000; 13 if(student[x].s1>90) ans+=2000; 14 if(student[x].s1>85&&student[x].west) ans+=1000; 15 if(student[x].s2>80&&student[x].ganbu) ans+=850; 16 if(ans>maxn) maxn=ans,num=x; 17 sum+=ans; 18 } 19 int main(){ 20 int n; 21 scanf("%d",&n); 22 for(int i=1;i<=n;i++){ 23 cin>>student[i].name>>student[i].s1>>student[i].s2; 24 char c; 25 getchar();c=getchar();getchar(); 26 if(c==‘Y‘) student[i].ganbu=1;else student[i].ganbu=0; 27 c=getchar(); 28 if(c==‘Y‘) student[i].west=1;else student[i].west=0; 29 cin>>student[i].p; 30 count(i); 31 } 32 cout<<student[num].name<<endl<<maxn<<endl<<sum; 33 return 0; 34 }
$Luogu\ P1052$ 过河
$Luogu\ P1053$ 篝火晚会
$Luogu\ P1054$ 等价表达式
原文:https://www.cnblogs.com/THWZF/p/11778366.html