C语言
  • 板块B2048 计算邮资
  • 楼主Hetop1
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/12/17 23:51
  • 上次更新2024/12/18 17:01:05
查看原帖
C语言
1535524
Hetop1楼主2024/12/17 23:51

求解,8号过不了(C)

if(x<=1000){
	if(ch=='y'){
		printf("13\n");
	}else if(ch=='n'){
		printf("8\n");
	}
}else {
	x-=1000;
	if(x%500!=0&&ch=='y'){
	  	int num=5+8+(x/500)*4+4;
	  	printf("%d\n",num);
	}else if(x%500==0&&ch=='y'){
	  	int num2=8+(x/500)*4;
	  	printf("%d\n",num2);
	}
	else if(ch=='n'&&x%500!=0){
			int num=8+(x/500)*4+4;
			printf("%d\n",num);
	}else if(ch=='n'&&x%500==0){
		int num2=8+(x/500)*4;
		printf("%d\n",num2);
	}
}
return 0;

}

2024/12/17 23:51
加载中...