75分,过不去了,蒟蒻求助QAQ
查看原帖
75分,过不去了,蒟蒻求助QAQ
432543
U_touchable楼主2020/11/18 14:49

#这是代码

#include<stdio.h>
int main(void){
	int n;
	int num, price;
	int sum[3]={0};
	scanf("%d",&n);
	int cnt = 0;
	for(cnt = 0; cnt < 3; cnt ++){
		scanf("%d%d",&num, &price);
		if(n % num == 0){
			sum[cnt] = n / num * price;
		}
		if(n % num != 0){
			sum[cnt] = ((n / num) + 1)* price;
		}
	}
	printf("%d %d %d",sum[0], sum[1], sum[2]);
	int i, min;
	min = 2147483647;
	for(i = 1; i < 3; i++){
		if(min > sum[i]){
			min = sum[i];
		}
	}
	printf("%d",min);
	return 0;
}
2020/11/18 14:49
加载中...