运行条件:Java JDK 21,且存放程序的文件名为 AKIOI.java
import javax.swing.*;
import java.awt.*;
import java.util.Objects;
import java.util.Random;
import java.net.URI;
public class AKIOI {
private static void showStartScreen() {
JFrame frame = new JFrame("AK IOI 黑科技宝典");
frame.setSize(800, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
frame.setLayout(new BorderLayout());
JPanel mainPanel = new JPanel(new GridLayout(6, 1, 10, 10));
mainPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
JLabel title = new JLabel("AK IOI 黑科技宝典", JLabel.CENTER);
title.setFont(new Font("宋体", Font.PLAIN, 30));
mainPanel.add(title);
JLabel introduction = new JLabel("拜读这本宝典,你可以:", JLabel.CENTER);
introduction.setFont(new Font("宋体", Font.PLAIN, 20));
mainPanel.add(introduction);
JLabel getPoints = new JLabel("1. 在 IOI 中拿到 -2147483648 分的好成绩。", JLabel.CENTER);
getPoints.setFont(new Font("宋体", Font.PLAIN, 20));
mainPanel.add(getPoints);
JLabel AB = new JLabel("2. 熟练掌握 A + B Problem。", JLabel.CENTER);
AB.setFont(new Font("宋体", Font.PLAIN, 20));
mainPanel.add(AB);
JLabel hello = new JLabel("3. 学会输出 'Hello World' 等高深操作", JLabel.CENTER);
hello.setFont(new Font("宋体", Font.BOLD, 20));
mainPanel.add(hello);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JButton start = new JButton("开始拜读");
start.setFont(new Font("宋体", Font.BOLD, 20));
start.setPreferredSize(new Dimension(200, 50));
start.addActionListener(e -> {
frame.setVisible(false);
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
throw new RuntimeException(ex);
}
JOptionPane.showMessageDialog(null, "你的 AK IOI 宝典不见了 awa", "啊嘞?", JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(null, "好吧其实被我吃了 awa", "贪吃这一块", JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(null, "等我问完你一些问题,你就可以正式拜读宝典了!", "qwq", JOptionPane.WARNING_MESSAGE);
String [] human = {"人类", "沃尔玛塑料袋", "大运", "我不知道", "Windows 11", "铅笔", "Type-C 接口", "瓶盖", "马里奥", "孙笑川", "东雪莲", "王金伟"};
String info = (String) JOptionPane.showInputDialog(null, "1 / 3: 你是什么物种?", "开户中...", JOptionPane.QUESTION_MESSAGE, null, human, human[0]);
if (Objects.equals(info, "人类")) {
JOptionPane.showMessageDialog(null, "人类不能看宝典 awa", "温(bao)馨(li)提示", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
else {
String answer = JOptionPane.showInputDialog(null, "2 / 3: 13 + 78 = ?", "答案是 91", JOptionPane.INFORMATION_MESSAGE);
if (Objects.equals(answer, "91") || answer.isEmpty()) {
if (Objects.equals(answer, "91")) {
JOptionPane.showMessageDialog(null, "你的算数确实不错,但是这里不是数学考试!", "91", JOptionPane.INFORMATION_MESSAGE);
}
else {
JOptionPane.showMessageDialog(null, "你太懒了吧!", " qwq", JOptionPane.INFORMATION_MESSAGE);
}
System.exit(0);
}
else {
String query = JOptionPane.showInputDialog(null, "3 / 3: 第 1 题中物种选择的列表有几项?", "爷青回", JOptionPane.INFORMATION_MESSAGE);
if (Objects.equals(query, "12")) {
JOptionPane.showMessageDialog(null, "666 资本你赢了。 你可以看 AK IOI 黑科技宝典了!", "666 没开我吃", JOptionPane.INFORMATION_MESSAGE);
BlackTechno bt = new BlackTechno();
bt.start();
}
else {
JOptionPane.showMessageDialog(null, "很遗憾,前 1 + 1 个问题你都答对了,但是你知道的, qwq", "太好了", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
}
});
buttonPanel.add(start);
buttonPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 20, 0));
frame.add(mainPanel, BorderLayout.CENTER);
frame.add(buttonPanel, BorderLayout.SOUTH);
frame.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(AKIOI::showStartScreen);
}
}
class BlackTechno {
public int clickTime = 0;
public void start() {
JFrame frame = new JFrame("AK IOI 黑科技宝典(真)");
frame.setSize(800, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
frame.setLayout(new BorderLayout());
JLabel title = new JLabel("点击按钮 81 下即可获得宝典", JLabel.CENTER);
title.setFont(new Font("宋体", Font.PLAIN, 30));
frame.add(title, BorderLayout.NORTH);
JButton button = new JButton("你还没有点击按钮 qwq");
button.setFont(new Font("宋体", Font.PLAIN, 30));
button.addActionListener(e -> {
if (clickTime == 81) {
button.setText("恭喜你坚持到了最后 awa!你将在 3 秒之后看到宝典!");
button.setEnabled(false);
Timer timer = new Timer(3000, e1 -> {
OpenBrowser.openUri("https://www.bilibili.com/video/BV1GJ411x7h7/?spm_id_from=333.337.search-card.all.click");
System.exit(0);
});
timer.setRepeats(false);
timer.start();
return;
}
if (clickTime == 24) {
frame.setVisible(false);
button.setText("对,刚才界面没有消失(逃)");
Timer timer = new Timer(1000, e1 -> {
frame.setVisible(true);
Timer subtimer = new Timer(500, e2 -> {
clickTime ++;
button.setText("你点击了按钮 " + clickTime + " 下");
});
subtimer.setRepeats(false);
subtimer.start();
});
timer.setRepeats(false);
timer.start();
} else if (clickTime == 41) {
button.setText("跑路了 qwq");
Point original = button.getLocation();
Random random = new Random();
int maxX = frame.getWidth() - button.getWidth() - 20;
int maxY = frame.getHeight() - button.getHeight() - 20;
int newX1 = random.nextInt(Math.max(1, maxX));
int newY1 = random.nextInt(Math.max(1, maxY));
button.setLocation(newX1, newY1);
Timer timer = new Timer(400, e1 -> {
int newX2 = random.nextInt(Math.max(1, maxX));
int newY2 = random.nextInt(Math.max(1, maxY));
button.setLocation(newX2, newY2);
Timer timer2 = new Timer(400, e2 -> {
int newX3 = random.nextInt(Math.max(1, maxX));
int newY3 = random.nextInt(Math.max(1, maxY));
button.setLocation(newX3, newY3);
Timer timer3 = new Timer(400, e3 -> {
button.setLocation(original);
clickTime++;
button.setText("你点击了按钮 " + clickTime + " 下");
});
timer3.setRepeats(false);
timer3.start();
});
timer2.setRepeats(false);
timer2.start();
});
timer.setRepeats(false);
timer.start();
} else if (clickTime == 75) {
button.setText("点我那么多次干嘛! qwq");
button.setEnabled(false);
Timer timer = new Timer(5000, e1 -> {
button.setEnabled(true);
clickTime ++;
button.setText("qwq. 你点击了按钮 " + clickTime + " 下");
});
timer.setRepeats(false);
timer.start();
} else {
clickTime++;
button.setText("你点击了按钮 " + clickTime + " 下");
}
});
frame.add(button, BorderLayout.SOUTH);
frame.setVisible(true);
}
}
class OpenBrowser {
public static void openUri(String uri) {
try {
URI urI = URI.create(uri);
Desktop dp = Desktop.getDesktop();
if (dp.isSupported(Desktop.Action.BROWSE)) {
dp.browse(urI);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
共 2 条回复
%%%%%%
%%%