#32614: C解-簡易


st99005912@gmail.com (Toby T༼ つ)

學校 : 國立臺灣科技大學
編號 : 195265
來源 : [140.118.133.245]
最後登入時間 :
2023-10-17 11:03:19
a244. 新手訓練 ~ for + if -- 新手訓練系列 ~ 1 | From: [220.129.183.149] | 發表日期 : 2022-10-23 20:43

#include <stdio.h>
int main()
{
unsigned int n = 0, i = 0;
unsigned short int a = 0;
long long int b = 0, c = 0;
scanf("%d", &n);
for (i = 0; i < n; i++)
{
scanf("%hd %lld %lld", &a, &b, &c);
if (a == 1)
{
b += c;
}
else if (a == 2)
{
b -= c;
}
else if (a == 3)
{
b *= c;
}
else if (a == 4)
{
b /= c;
}
printf("%lld\n", b);
}
}
 
ZeroJudge Forum