Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Last active November 5, 2019 08:47
Show Gist options
  • Save pinglunliao/2c38cf8bfd0dd307c049 to your computer and use it in GitHub Desktop.
Save pinglunliao/2c38cf8bfd0dd307c049 to your computer and use it in GitHub Desktop.
a244: 新手訓練 ~ for + if FYI: https://yunlinsong.blogspot.com/2015/12/for-if.html
#include <cstdio>
int main() {
int n;
while(scanf("%d", &n) != EOF)
{
int a;
long long int b, c;
for(int i = 0; i < n; i++)
{
scanf("%d %lld %lld", &a, &b, &c);
switch(a) {
case 1:
printf("%lld", b+c);
break;
case 2:
printf("%lld", b-c);
break;
case 3:
printf("%lld", b*c);
break;
case 4:
printf("%lld", b/c);
break;
default:
break;
}
printf("\n");
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment