Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
7053 | 邓小龙 | 19斯诺克比赛 | C++ | Accepted | 0 MS | 264 KB | 662 | 2025-04-04 14:51:14 |
#include<bits/stdc++.h> // cin\cout\endl using namespace std; int a[8],temp,_max; int main(){ //模拟打球过程 //只要红球数量不为0,那么打一次红+一次最大的彩 //当红为0时,将剩下的彩球数量的分数加上 //1:红 2:黄 3:绿 4:棕 5:蓝 6:粉 7:黑 for(int i=1;i<=7;i++){ cin>>a[i];//输入各种颜色球的数量 //同时记录场地上最高分的球 if(a[i]>0) _max=i; } while(a[1]--){//红球不为0,分数:1+_max temp+=(1+_max); } for(int i=2;i<=_max;i++){ while(a[i]--)temp+=i; } cout<<temp<<endl; return 0; }