# 小斐和他的计算器

``````2
123
456``````

``````6 6
7 8``````

``````#include <stdio.h>
int main()
{
int t,i;
int x,y;
char str[105];
scanf("%d",&t);
while(t--)
{
x=0,y=0,i=0;
scanf("%s",&str);
while(str[i]!='\0')
{
switch(str[i])
{
case '0':
x=x+2;
y=y+4;
break;
case '1':
y=y+2;
break;
case '2':
x=x+3;
y=y+2;
break;
case '3':
x=x+3;
y=y+2;
break;
case '4':
x=x+1;
y=y+3;
break;
case '5':
x=x+3;
y=y+2;
break;
case '6':
x=x+3;
y=y+3;
break;
case '7':
x=x+1;
y=y+2;
break;
case '8':
x=x+3;
y=y+4;
break;
case '9':
x=x+3;
y=y+3;
break;
case '+':
x=x+1;
y=y+1;
break;
case '-':
x=x+1;
break;
case '=':
x=x+2;
break;
default :
break;
}
i++;
}
printf("%d %d\n",x,y);
}
return 0;
}
``````

``````#include <stdio.h>
int main()
{
int t,i;
int x,y;
char str[105];
scanf("%d",&t);
while(t--)
{
x=0,y=0,i=0;
scanf("%s",&str);
while(str[i]!='\0')
{
switch(str[i])
{
case '0':
x=x+2;
y=y+4;
break;
case '1':
y=y+2;
break;
case '2':
x=x+3;
y=y+2;
break;
case '3':
x=x+3;
y=y+2;
break;
case '4':
x=x+1;
y=y+3;
break;
case '5':
x=x+3;
y=y+2;
break;
case '6':
x=x+3;
y=y+3;
break;
case '7':
x=x+1;
y=y+2;
break;
case '8':
x=x+3;
y=y+4;
break;
case '9':
x=x+3;
y=y+3;
break;
case '+':
x=x+1;
y=y+1;
break;
case '-':
x=x+1;
break;
case '=':
x=x+2;
break;
default :
break;
}
i++;
}
printf("%d %d\n",x,y);
}
return 0;
}
``````