prepare for the provincial time --10.1--Hard to Play

来源:互联网 发布:js左右滑动图片轮播 编辑:程序博客网 时间:2024/05/26 19:18

Hard to Play

            这是第十届省赛题目中通过率最高的一道题目,不能更简单。昨天做的,训练第一天。

            题意:题目分别给出某个人在一场游戏中得到30010050分的局数,然后给出计算游戏总得分的公式,根据这个公式,在越靠后的局数,这一局的分数乘以的倍数最大。问通过这种计算方式,这个人可能得到的最大游戏总得分和最少的游戏总得分。

思路没什么,最大的分就把大的分数往后放,最少得分就把小的分数往靠后的局数放。

            细节+代码:

           

#include<stdio.h>int main(){int T,i,j,a,b,c,sum,minscore,maxscore;scanf("%d",&T);for(i = 1;i<=T;i++){scanf("%d%d%d",&a,&b,&c);sum = a+b+c;maxscore = 0;for(j = sum-1;j>=sum-a;j--)maxscore = maxscore+300*(j*2+1);for(j = sum-a-1;j>=sum-a-b;j--)maxscore = maxscore+100*(j*2+1);for(j = sum-a-b-1;j>=sum-a-b-c;j--)maxscore = maxscore+50*(j*2+1);sum = a+b+c;minscore = 0;for(j = sum-1;j>=sum-c;j--)minscore = minscore+50*(j*2+1);for(j = sum-c-1;j>=sum-c-b;j--)  minscore = minscore+100*(j*2+1);for(j = sum-c-b-1;j>=sum-a-b-c;j--)minscore = minscore+300*(j*2+1);printf("%d %d\n",minscore,maxscore);}}


 

0 0