#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int Case,flagU,flagI,flagP,count,j;
double u,i,p,t;
char c,d,prefix;
cin>>Case;
for(j=1;j<=Case;j++)
{
cout<<"Problem #"<<j<<endl;
flagU=0,flagI=0,flagP=0;
u=0,i=0,p=0,t=0,count=2;
cin>>c;
while(c!='\n'&&count)
{
if(c=='U'||c=='I'||c=='P')
{
cin>>d;
if(d=='=')
{
count--;
scanf("%lf%c",&t,&prefix);
switch(prefix)
{
case 'm':t/=1000;break;
case 'k':t*=1000;break;
case 'M':t*=1000000;break;
}
switch(c)
{
case 'U':u=t;flagU=1;break;
case 'I':i=t;flagI=1;break;
case 'P':p=t;flagP=1;break;
}
}
}
cin>>c;
}
if(!flagP)
printf("P=%.2lfW\n",u*i);
if(!flagU)
printf("U=%.2lfV\n",p/i);
if(!flagI)
printf("I=%.2lfA\n",p/u);
cout<<endl;
}
return 0;
}
UVA - 537 Artificial Intelligence?
最新推荐文章于 2019-04-29 13:34:38 发布