首页 > 代码库 > hdu ACM Steps 1.2.8 Balloon Comes!

hdu ACM Steps 1.2.8 Balloon Comes!

水题

#include<cstdio>

char s[10];
int T,a,b,res;

int main() {
    scanf("%d",&T);
    while(T--) {
        scanf("%s%d%d",s,&a,&b);
        switch (s[0]) {
            case + : printf("%d\n",a+b); break;
            case - : printf("%d\n",a-b); break;
            case * : printf("%d\n",a*b); break;
            case / :
                if(a%b) printf("%.2lf\n",(double)a/b); 
                else printf("%d\n",a/b);
            break;
        }
    }
    return 0;
}

hdu ACM Steps 1.2.8 Balloon Comes!