import java.util.Random;

public class HeadshotRateSimulator {
    private static final Random random = new Random();

    // 初始爆头概率
    private double headshotRate = 0.1; // 初始10%爆头概率
    private double maxHeadshotRate = 0.5; // 最大爆头概率50%

    // 模拟射击
    public boolean shoot() {
        boolean isHeadshot = random.nextDouble() < headshotRate;
        if (isHeadshot) {
            // 如果爆头成功，重置爆头概率
            headshotRate = 0.1;
        } else {
            // 如果未爆头，增加爆头概率
            headshotRate += 0.05;
            if (headshotRate > maxHeadshotRate) {
                headshotRate = maxHeadshotRate;
            }
        }
        return isHeadshot;
    }

    // 模拟多次射击
    public void simulateShots(int totalShots) {
        int headshots = 0;
        for (int i = 0; i < totalShots; i++) {
            if (shoot()) {
                headshots++;
                System.out.println("射击 " + (i + 1) + ": 爆头！");
            } else {
                System.out.println("射击 " + (i + 1) + ": 未爆头");
            }
        }
        System.out.println("总射击次数: " + totalShots);
        System.out.println("爆头次数: " + headshots);
        System.out.println("爆头率: " + (headshots * 100.0 / totalShots) + "%");
    }

    public static void main(String[] args) {
        HeadshotRateSimulator simulator = new HeadshotRateSimulator();
        simulator.simulateShots(20); // 模拟20次射击
    }
}