题目:http://acm.hrbust.edu.cn/vj/index.php?c=problem-problem&id=347265
代码:
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
int num[4]= {300,100,50};
while(t--)
{
int a[3];
scanf("%d%d%d",&a[0],&a[1],&a[2]);
int ans=0;
int x=0;
int temp;
for(int i=0; i<3; i++)
{
temp=num[i];
for(int j=0; j<a[i]; j++)
{
ans=ans+temp*(x*2+1);
x=x+1;
}
}
printf("%d ",ans);
ans=0;x=0;
for(int i=2;i>=0;i--)
{
temp=num[i];
for(int j=0;j<a[i];j++)
{
ans=ans+temp*(x*2+1);
x++;
}
}
printf("%d\n",ans);
}
}
#include<iostream>
#include<queue>
using namespace std;
queue<int> G;
queue<int> P;
int Max()
{
int p=0;
int combo=0;
while(!G.empty())
{
p+=G.front()*(combo*2+1);
G.pop();
combo++;
}
return p;
}
int Min()
{
int p=0;
int combo=0;
while(!P.empty())
{
p+=P.front()*(combo*2+1);
P.pop();
combo++;
}
return p;
}
int main()
{
int T;
cin>>T;
while(T--)
{
while(!G.empty())G.pop();
while(!P.empty())P.pop();
int A,B,C;
cin>>A>>B>>C;
int sum=A+B+C;
int i;
for(i=0;i<C;i++)
{
G.push(50);
}
for(i=0;i<B;i++)
{
G.push(100);
}
for(i=0;i<A;i++)
{
G.push(300);
}
for(i=0;i<A;i++) P.push(300);
for(i=0;i<B;i++) P.push(100);
for(i=0;i<C;i++) P.push(50);
cout<<Min()<<" "<<Max()<<endl;
}
}