CCF-CSP 201709-1 打酱油(C语言)

CCF-CSP 201709-1 打酱油(C语言)

#include <stdio.h>

int main(){
	int N,price = 10,sum;
	scanf("%d",&N);
	
	if(N<30){
		sum = N / price;
	}
	else if(N>=30&&N<50){
		sum = 4+(N-30)/price;
	}
	else if(N>=50&&N<80){
		sum = 7+(N-50)/price;
	}
	else if(N>=80&&N<100){
		sum = 7+4+(N-80)/price;
	}
	else if(N>=100&&N<=300){
		int x = N / 50;
		int s = N - 50 * x;
		int y;
		if(s>=30){
			y = s / 30;
		}
		else{
			y=0;
		}
		int s3 = s-30*y;
		
		sum = 7 * x+4*y+s3 / price; 
	} 
	
	printf("%d",sum);
	
	return 0;
}
上一篇:csp 13-3命令行选项


下一篇:CSP 收容注意事项