题解 | #计算单位阶跃函数#
计算单位阶跃函数
http://www.nowcoder.com/practice/0b23793ae48a4e6cb7dfff042c959a04
#include<stdio.h>
int main() {
int a;
while (scanf("%d", &a) != EOF) {
if (a > 0) printf("1\n");
else if (a == 0) printf("0.5\n");
else printf("0\n");
}
return 0;
}
int main() {
int a;
while (scanf("%d", &a) != EOF) {
if (a > 0) printf("1\n");
else if (a == 0) printf("0.5\n");
else printf("0\n");
}
return 0;
}