HPU1477: Operation on sequence————水题

题目描述
真·签到题
输入一个表达式AA opop BB opop操作为′+′,′−′,′∗′′+′,′−′,′∗′ ,A,BA,B为整数

输入
第一行输入 T 组数据 T ( 1 T 1 e 2 )
第二行输入 A o p B ( 1 e 9 A , B 1 e 9 ) — 初始序列
输出
输出表达式结果并换行即可
样例输入
1
1 + 1
样例输出
2


水题,没啥说的


code

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int main()
{
    LL a,b;
    char c;
    int t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%lld %c %lld",&a,&c,&b);
        if(c=='+')  printf("%lld\n",a+b);
        if(c=='-')  printf("%lld\n",a-b);
        if(c=='*')  printf("%lld\n",a*b);
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/hpuer_random/article/details/81287046