题解 | 小红喜欢1

小红喜欢1

https://www.nowcoder.com/practice/cbd0c91f821847a4bb1c5115405f6eda

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int [] a = new int [5];
        for(int i = 0; i<5;i++){
            a[i]=in.nextInt();
            if(a[i]==1){
                System.out.println(i+1);
            }
        }
    }
}

全部评论

相关推荐

01-23 19:11
已编辑
门头沟学院 前端工程师
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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