谁获得了最高奖学金
?
誰獲得了最高獎學金http://acm.nyist.net/JudgeOnline/problem.php?pid=60
時間限制:1000 ms ?|? 內存限制:65535 KB 難度:2 描述1) 院士獎學金,每人8000元,期末平均成績高于80分(>80),并且在本學期內發表1篇或1篇以上論文的學生均可獲得;
2) 五四獎學金,每人4000元,期末平均成績高于85分(>85),并且班級評議成績高于80分(>80)的學生均可獲得;
3) 成績優秀獎,每人2000元,期末平均成績高于90分(>90)的學生均可獲得;
4) 西部獎學金,每人1000元,期末平均成績高于85分(>85)的西部省份學生均可獲得;
5) 班級貢獻獎,每人850元,班級評議成績高于80分(>80)的學生干部均可獲得;
只要符合條件就可以得獎,每項獎學金的獲獎人數沒有限制,每名學生也可以同時獲得多項獎學金。例如姚林的期末平均成績是87分,班級評議成績82分,同時他還是一位學生干部,那么他可以同時獲得五四獎學金和班級貢獻獎,獎金總數是4850元。
現在給出若干學生的相關數據,請計算哪些同學獲得的獎金總數最高(假設總有同學能滿足獲得獎學金的條件)。
#include<string.h>
int main()
{
?int n;
?scanf("%d",&n);
?while(n--)
?{
??int m;
??int i,j,a[2]={0,0},b[2]={0,0},c[2]={0,0},f[2]={0,0};
??int count[2]={0,0},sum=0;
??char d,e,k,o,g[25],h[25];
??scanf("%d",&m);
??scanf("%s %d %d %c %c %d",g,&a[0],&b[0],&d,&e,&f[0]);
??if(a[0]>80&&f[0]>0)
???count[0]+=8000;
??if(a[0]>85&&b[0]>80)
???count[0]+=4000;
??if(a[0]>90)
???count[0]+=2000;
??if(a[0]>85&&e=='Y')
???count[0]+=1000;
??if(b[0]>80&&d=='Y')
???count[0]+=850;
??sum+=count[0];
??for(i=1;i<m;i++)
??{
???count[1]=0;
??/*?for(j=0;j<25;j++)
????h[j]='\0';*/
???scanf("%s %d %d %c %c %d",h,&a[1],&b[1],&k,&o,&f[1]);
???if(a[1]>80&&f[1]>0)
????count[1]+=8000;
???if(a[1]>85&&b[1]>80)
????count[1]+=4000;
???if(a[1]>90)
????count[1]+=2000;
???if(a[1]>85&&o=='Y')
????count[1]+=1000;
???if(b[1]>80&&k=='Y')
????count[1]+=850;
???sum+=count[1];
???if(count[0]<count[1])
???{
????count[0]=count[1];
????strcpy(g,h);
?/*???for(j=0;j<25;j++)
????{
?????g[j]='\0';
?????g[j]=h[j];
????}*/
???}
??}
??printf("%s\n",g);
??printf("%ld\n",count[0]);
??printf("%ld\n",sum);
?}
?return 0;
}
#include<string.h>
int main()
{
?int n;
?scanf("%d",&n);
?while(n--)
?{
??int m,a,b,c,max=0,sum=0;
??char d,e;
??char ming[25],mi[25];
??scanf("%d",&m);
??while(m--)
??{
???int max1=0;
???scanf("%s %d %d %c %c %d",ming,&a,&b,&d,&e,&c);
???if(a>80&&c>0)
????max1+=8000;
???if(a>85&&b>80)
????max1+=4000;
???if(a>90)
????max1+=2000;
???if(a>85&&e=='Y')
????max1+=1000;
???if(b>80&&d=='Y')
????max1+=850;
???sum+=max1;
???if(max<max1)
???{
????max=max1;
????strcpy(mi,ming);
???}
??}
??printf("%s\n",mi);
??printf("%d\n%d\n",max,sum);
?}
?return 0;
}
轉載于:https://www.cnblogs.com/wangyouxuan/p/3228522.html
總結
- 上一篇: Linux文件和目录权限
- 下一篇: win设置壁纸