跳到正文

sky_jiang2354

1636166

最后上线时间:2026.9.13.12:00||小号little_JYN||宣团https://www.luogu.com.cn/team/133390

在洛谷打开
资料、奖项与版本

资料

编号
1636166
抓取

陶片放逐

+ 进入主站
− 发送私信
− 进入主站

查看记录

本人的小号little_JYN

便利:1(OI)

C++
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
  	return 0;
}

便利:2(日常)

C++
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{ 
  	ios::sync_with_stdio(0);
  	cin.tie(0);
    
  	return 0;
}

快读

C++
void read(int x)
{ 
    int f = 1;
    x = 0;
    char s=getchar();
    while(s < '0' || s > '9'){
        if(s == '-')
            f = -1;
		s = getchar();
	}
	while(s >='0' && s <= '9'){
		x = x * 10 + s - '0';
		s = getchar();
	}
	x *= f;
}

快写

C++
void write(int x)
{
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}

轮换点点器

C++
#include <iostream>
#include <windows.h>
#include <conio.h>
#include <string>
using namespace std;

const int MAX_POINTS = 50;
int points[MAX_POINTS][2];
int pointCount = 0;
bool isRunRotate = false;

int clickCount = 1;
int totalRounds = 1;
int clickButton = 1;
int delayMs = 100;
int currentIndex = 0;
int currentClick = 0;
int currentRound = 0;

bool leftClickRun = false;
bool rightClickRun = false;

void MoveMouse(int x, int y)
{
    int w = GetSystemMetrics(SM_CXSCREEN);
    int h = GetSystemMetrics(SM_CYSCREEN);
    INPUT mi = { 0 };
    mi.type = INPUT_MOUSE;
    mi.mi.dx = (x * 65535) / w;
    mi.mi.dy = (y * 65535) / h;
    mi.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
    SendInput(1, &mi, sizeof(INPUT));
}

void MouseClick(int btn)
{
    INPUT mi = { 0 };
    mi.type = INPUT_MOUSE;
    switch (btn)
    {
        case 1: mi.mi.dwFlags = MOUSEEVENTF_LEFTDOWN; break;
        case 2: mi.mi.dwFlags = MOUSEEVENTF_RIGHTDOWN; break;
        case 3: mi.mi.dwFlags = MOUSEEVENTF_MIDDLEDOWN; break;
    }
    SendInput(1, &mi, sizeof(INPUT));
    Sleep(10);

    ZeroMemory(&mi, sizeof(INPUT));
    mi.type = INPUT_MOUSE;
    switch (btn)
    {
        case 1: mi.mi.dwFlags = MOUSEEVENTF_LEFTUP; break;
        case 2: mi.mi.dwFlags = MOUSEEVENTF_RIGHTUP; break;
        case 3: mi.mi.dwFlags = MOUSEEVENTF_MIDDLEUP; break;
    }
    SendInput(1, &mi, sizeof(INPUT));
}

void GetMousePos(int &x, int &y)
{
    POINT pt;
    GetCursorPos(&pt);
    x = pt.x;
    y = pt.y;
}

void ShowHomePage()
{
    system("cls");
    SetConsoleTitleA("鼠标点击器 - 主页");
    cout << "========== 主 页 ==========" << endl;
    cout << "  1  -> 进入普通点击器" << endl;
    cout << "  2  -> 进入轮换点击器" << endl;
    cout << " ESC -> 退出程序" << endl;
    cout << "===========================" << endl;
}

void ShowNormalTool()
{
    system("cls");
    SetConsoleTitleA("普通点击器");
    cout << "===== 普通点击器 =====" << endl;
    cout << "每秒点击次数:" << 1000 / delayMs << endl;
    cout << "----------------------" << endl;
    cout << " 1  = 开始/停止 左键连点" << endl;
    cout << " 2  = 开始/停止 右键连点" << endl;
    cout << " 3  = 设置每秒点击次数" << endl;
    cout << " ESC= 返回主页" << endl;
    cout << "======================" << endl << endl;
}

void ShowRotateTool()
{
    system("cls");
    SetConsoleTitleA("轮换点击器");
    cout << "===== 轮换点击器 =====" << endl;
    cout << "已记录坐标:" << pointCount << " 个" << endl;
    cout << "每秒点击次数:" << 1000 / delayMs << endl;
    cout << "总循环轮数:" << totalRounds << endl;
    string btnStr = (clickButton == 1) ? "左键" : (clickButton == 2) ? "右键" : "中键";
    cout << "当前点击按键:" << btnStr << endl;
    cout << "----------------------" << endl;
    cout << " 1         = 记录当前坐标" << endl;
    cout << " Backspace = 清空所有坐标" << endl;
    cout << " 空格      = 开始/停止轮换" << endl;
    cout << " E         = 设置每秒点击次数" << endl;
    cout << " R         = 设置总循环轮数" << endl;
    cout << " T         = 切换点击按键" << endl;
    cout << " ESC       = 返回主页" << endl;
    cout << "======================" << endl << endl;
}

int main()
{
    int page = 0;
    ShowHomePage();

    while (true)
    {
        if (_kbhit())
        {
            char key = _getch();

            if (page == 0)
            {
                if (key == '1')
                {
                    page = 1;
                    leftClickRun = false;
                    rightClickRun = false;
                    ShowNormalTool();
                }
                else if (key == '2')
                {
                    page = 2;
                    isRunRotate = false;
                    currentIndex = 0;
                    currentClick = 0;
                    currentRound = 0;
                    ShowRotateTool();
                }
                else if (key == 27)
                {
                    cout << "程序退出..." << endl;
                    Sleep(300);
                    return 0;
                }
            }

            else if (page == 1)
            {
                if (key == 27)
                {
                    leftClickRun = false;
                    rightClickRun = false;
                    page = 0;
                    ShowHomePage();
                    continue;
                }
                if (key == '1')
                {
                    leftClickRun = !leftClickRun;
                    rightClickRun = false;
                    cout << (leftClickRun ? "[左键连点] 已开启" : "[左键连点] 已关闭") << endl;
                }
                else if (key == '2')
                {
                    rightClickRun = !rightClickRun;
                    leftClickRun = false;
                    cout << (rightClickRun ? "[右键连点] 已开启" : "[右键连点] 已关闭") << endl;
                }
                else if (key == '3')
                {
                    int speed;
                    cout << "请输入每秒点击次数:";
                    cin >> speed;
                    if (speed < 1) speed = 1;
                    delayMs = 1000 / speed;
                    ShowNormalTool();
                }
            }

            else if (page == 2)
            {
                if (key == 27)
                {
                    isRunRotate = false;
                    page = 0;
                    ShowHomePage();
                    continue;
                }

                // Backspace 清空坐标
                if (key == '\b')
                {
                    pointCount = 0;
                    isRunRotate = false;
                    cout << "[已清空] 所有坐标数据已重置!" << endl;
                    ShowRotateTool();
                }

                if (key == '1')
                {
                    if (pointCount >= MAX_POINTS)
                        cout << "[提示] 坐标数量已达上限!" << endl;
                    else
                    {
                        int x, y;
                        GetMousePos(x, y);
                        points[pointCount][0] = x;
                        points[pointCount][1] = y;
                        pointCount++;
                        cout << "[记录] 第" << pointCount << "个坐标:(" << x << "," << y << ")" << endl;
                    }
                }

                if (key == ' ')
                {
                    if (pointCount == 0)
                        cout << "[提示] 请先按 1 记录坐标!" << endl;
                    else
                    {
                        isRunRotate = !isRunRotate;
                        if (isRunRotate)
                        {
                            currentIndex = 0;
                            currentClick = 0;
                            currentRound = 0;
                            cout << "\n>>> 开始轮换点击 <<<" << endl;
                        }
                        else
                            cout << "\n>>> 已停止轮换 <<<" << endl;
                    }
                }

                if (key == 'e' || key == 'E')
                {
                    int speed;
                    cout << "请输入每秒点击次数:";
                    cin >> speed;
                    if (speed < 1) speed = 1;
                    delayMs = 1000 / speed;
                    ShowRotateTool();
                }
                if (key == 'r' || key == 'R')
                {
                    cout << "请输入总循环轮数:";
                    cin >> totalRounds;
                    if (totalRounds < 1) totalRounds = 1;
                    ShowRotateTool();
                }
                if (key == 't' || key == 'T')
                {
                    cout << "选择按键(1=左键 2=右键 3=中键):";
                    cin >> clickButton;
                    if (clickButton < 1 || clickButton > 3) clickButton = 1;
                    ShowRotateTool();
                }
            }
        }

        if (page == 1)
        {
            if (leftClickRun)
            {
                MouseClick(1);
                Sleep(delayMs);
            }
            if (rightClickRun)
            {
                MouseClick(2);
                Sleep(delayMs);
            }
        }

        if (page == 2 && isRunRotate && pointCount > 0)
        {
            if (currentClick < clickCount)
            {
                int x = points[currentIndex][0];
                int y = points[currentIndex][1];
                MoveMouse(x, y);
                MouseClick(clickButton);
                currentClick++;
                Sleep(delayMs);
            }
            else
            {
                currentClick = 0;
                currentIndex++;
                if (currentIndex >= pointCount)
                {
                    currentIndex = 0;
                    currentRound++;
                    cout << "[完成] 第 " << currentRound << " 轮" << endl;
                    if (currentRound >= totalRounds)
                    {
                        isRunRotate = false;
                        cout << "\n>>> 全部轮次执行完毕,自动停止 <<<" << endl;
                    }
                }
            }
        }
        Sleep(1);
    }
    return 0;
}

还没有收录这位用户的文章。