题解 | #牛牛的快递#

牛牛的快递

https://www.nowcoder.com/practice/41b42e7b3c3547e3acf8e90c41d98270

#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
	float a;
	char b;
	int price;
	scanf("%f %c", &a, &b);
	float more = a - 1;
	if (more > 0) {
		if ((int)more == more) {
			price = 20 + (int)more;
		}
		else {
			price = 20 + (int)more + 1;
		}
		if (b == 'y') {
			price += 5;
		}
	}
	else {
		price = 20;
		if (b == 'y') {
			price += 5;
		}
	}
	printf("%d", price);
	return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务