题解 | #计算单位阶跃函数#

计算单位阶跃函数

http://www.nowcoder.com/practice/0b23793ae48a4e6cb7dfff042c959a04

import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNextInt()) {
            int time = scan.nextInt();
            if(time > 0) {
                System.out.println(1);
            } else if(time == 0) {
                System.out.println(0.5);
            } else {
                System.out.println(0);
            }
            
        }
    }
}
全部评论

相关推荐

每晚夜里独自颤抖:这个在牛客不是老熟人了吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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