题解 | #网购#

网购

https://www.nowcoder.com/practice/5d7dfd405e5f4e4fbfdff6862c46b751

#include<stdio.h>
int main()
{
	double price = 0; 
	int month = 0; 
	int day = 0;
	int discount = 0;  
	scanf("%lf %d %d %d", &price , &month , &day , &discount); 
	if (month == 11 && day == 11)
	{
		if (discount == 1)
		{
			price =price*0.7 - 50;  
		}
		else if(discount == 0 )
		{
			price =price*0.7; 
		}
	}
	if (month == 12 && day == 12)
	{
		if (discount == 1)
		{
			price = price * 0.8 - 50;
		}
		else if (discount == 0)
		{
			price = price * 0.8;
		}
	}
	if (price <= 0)
		printf("%.2lf", 0); 
	else
		printf("%.2lf", price);    
	return 0; 
}

全部评论

相关推荐

2025-12-17 13:34
复旦大学 算法工程师
回家当保安:复旦✌🏻,佬你的简历感觉挺好的,寒假日常hc比较少。佬可以过完年之后再试试,日常实习hc比较充足
点赞 评论 收藏
分享
01-06 22:57
武汉大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务