調分計算

 avatar
user_3763047219
c_cpp
2 years ago
469 B
0
Indexable
Never
#include <stdio.h>
int main()
{
	int num,flag=0,score=0;
	scanf("%d", &num);
	if (num <= 10) {
		flag = 1;
	}
	else if (num >=11 && num <= 20) {
		flag = 2;
	}
	else if(num>=21 && num<=40) {
		flag = 3;
	}
	else if (num>40) {
		flag = 4;
	}

	switch (flag) {
	case 1:
		score=num * 6;
		break;
	case 2:
		score=(num - 10) * 2 + 10 * 6;
		break;
	case 3:
		score = (num - 20) * 1 + 10 * 6 + 10 * 2;
		break;
	case 4 :
		score = 100;
		break;
	}
	printf("%d", score);
	
}