阿里巴巴的暗号问题

我的错误是:

import java.util.Scanner;
import java.io.PrintStream;

public class 阿里巴巴的暗号 {
    public static void main(String[] args) throws java.io.UnsupportedEncodingException {
        PrintStream ps = new PrintStream(System.out, true, "UTF-8");
        Scanner in = new Scanner(System.in);

        int mima = in.nextInt();
        int cishu = 0;

        for (int i = 0; i <= 5; i++) {
            int shuru = in.nextInt();
            if (shuru == mima && cishu <= 2) {
                cishu = cishu + 1;
                ps.println("欢迎回来!");
                break;
            } else if (cishu >= 3 && cishu < 5) {
                cishu = cishu + 1;
                ps.println("欢迎回来!");
                ps.println("该账户异常,有x次失败登录。为安全起见,请考虑更改密码。");
                break;
            } else if (cishu > 5) {
                cishu = cishu + 1;
                ps.println("密码错误次数过多,您的账户已被锁定。");
            }
        }

1 条评论

  • 1