• 个人简介

    好东西

    快来玩玩,29592字,没个5分钟看不完。

    Page Views CountPage Views CountPage Views Count

    感谢。。。

    上课期间不要看主页,被抓腐一律不负责

    以下正文

    :)

    各种网站

    好笑的图


    文章

    小程序

    双人射击小游戏
    //单机版枪战游戏
    //by floatiy
    #include<iostream>
    #include<cstdio>
    #include<windows.h>
    #include<conio.h>
    using namespace std;
    int SIZ = 20;
    HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coord;
    HANDLE hCon;
    enum Color { DARKBLUE = 1, DARKGREEN, DARKTEAL, DARKRED, DARKPINK, DARKYELLOW, GRAY, DARKGRAY, BLUE, GREEN, TEAL, RED, PINK, YELLOW, WHITE };
    void SetColor(Color c) {
        if(hCon == NULL)
            hCon = GetStdHandle(STD_OUTPUT_HANDLE);
        SetConsoleTextAttribute(hCon, c);
    }
    SYSTEMTIME sys;
    //sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute, sys.wSecond,sys.wMilliseconds,sys.wDayOfWeek
    struct PLAYER {
        int x,y;
        int hp;
        int gun;
        int direct;
    } p1,p2;
    int map[1005][1005];
    int abs(int x) {
        if(x < 0) return -x;
        return x;
    }
    void locate(int x,int y) {
        coord.X=y - 1;
        coord.Y=x - 1;
        SetConsoleCursorPosition(hout,coord);
    }
    void print_map() {
        locate(1,1);
        SetColor(GRAY);
        for(int i = 1; i <= SIZ; i++) cout<<"■";
        locate(SIZ,1);
        for(int i = 1; i <= SIZ; i++) cout<<"■";
        for(int i = 2; i < SIZ; i++) {
            locate(i,1);
            cout<<"■";
            locate(i,SIZ*2-1);
            cout<<"■";
        }
        locate(SIZ+1,1);
        SetColor(WHITE);
    }
    void create_tree(int x,int y) {
        map[x][y] = map[x+1][y] = map[x-1][y] = map[x][y+1] = map[x][y-1] = 2;
    }
    void use_map(int x) {
        if(x == 1) {
            SIZ = 20;
            SetColor(DARKGREEN);
            map[16][6]=map[15][6]=map[17][6]=map[16][7]=map[16][5]=map[14][13]=map[13][12]=map[13][13]=2;
            for(int i = 2; i < SIZ; i++) {
                for(int j = 2; j < SIZ; j++) {
                    if(map[i][j] == 2) {
                        locate(i,j*2-1);
                        cout<<"■";
                    }
                }
            }
            SetColor(GRAY);
            for(int i = 5; i <= 15; i++) {
                map[i][i] = 1;
                locate(i,i*2-1);
                cout<<"■";
            }
            SetColor(WHITE);
        } else if(x == 2) {
            SIZ = 30;
            SetColor(GRAY);
            for(int i = 4; i <= 26; i++) {
                if(i == 13 || i == 14 ||i == 15) continue;
                map[i][4] = map[4][i] = map[26][i] = map[i][26] = 1;
            }
            for(int i = 1; i <= SIZ; i++) {
                for(int j = 1; j <= SIZ; j++) {
                    if(map[i][j] == 1) {
                        locate(i,j*2-1);
                        cout<<"■";
                    }
                }
            }
            SetColor(DARKGREEN);
            for(int i = 10; i<=20; i++) {
                if(i == 13 || i == 17) continue;
                map[i][10] = map[10][i] = map[20][i] = map[i][20] = 2;
            }
            create_tree(5,5);
            create_tree(18,18);
            for(int i = 1; i <= SIZ; i++) {
                for(int j = 1; j <= SIZ; j++) {
                    if(map[i][j] == 2) {
                        locate(i,j*2-1);
                        cout<<"■";
                    }
                }
            }
            SetColor(WHITE);
        }
    }
    void cleanbody(int x,int y);
    void putbody(int x,int y,int z);
    void player_init() {
        p1.hp = p2.hp = 300;
        p1.gun = p2.gun = 1;
        p1.direct = 4;
        p2.direct = 2;
        p1.x = 2;
        p1.y = 2;
        p2.x = SIZ - 1;
        p2.y = SIZ - 1;
        putbody(p1.x,p1.y,1);
        putbody(p2.x,p2.y,2);
    }
    void mapinit() {
        for(int i = 1; i <= SIZ; i++) {
            map[i][1] = map[1][i] = map[SIZ][i] = map[i][SIZ] = 1;
        }
    }
    void init() {
        printf("Use Which Map?\n");
        int x;
        cin>>x;
        system("cls");
        use_map(x);
        mapinit();
        print_map();
        player_init();
    }
    void putbody(int x,int y,int z) {
        if(z == 1) SetColor(BLUE);
        else if(z == 2) SetColor(RED);
        locate(x,y*2-1);
        cout<<"■";
        SetColor(WHITE);
    }
    void cleanbody(int x,int y) {
        locate(x,y*2-1);
        cout<<" ";
    }
    /*
        LIST
        direct:
            w 1
            a 2
            s 3
            d 4
        gun:
            usp 1
            mimigun 2
            awp 3
        block:
            void 0
            stone 1
            tree 2
            player 3
            clip 4
    */
    bool judge(int x,int y) {
        if(map[x][y] == 1) return false;
        if(map[x][y] == 2) return false;
        if(map[x][y] == 3) return false;
        return true;
    }
    bool judge_gun(int x,int y) {
        if(map[x][y] == 1) return 0;
        if(map[x][y] == 2) return 0;
        if(map[x][y] == 3) {
            if(p1.x == x && p1.y == y) p1.hp -= 50;//此处暂时不管威力
            else p2.hp -= 50;
            return 0;
        }
        return 1;
    }
    int cnt;
    struct Clip {
        int x,y;
        int derect;
        int force;
        int start;
        bool flag;
    } clip[1000000];
    void create_clip(int y,int x,int a,int b) {
        int X,Y;
        if(y == 1) {
            if(!judge_gun(a-1,b)) return;
            X = a-1;
            Y = b;
        } else if(y == 2) {
            if(!judge_gun(a,b-1)) return;
            X = a;
            Y = b-1;
        } else if(y == 3) {
            if(!judge_gun(a+1,b)) return;
            X = a+1;
            Y = b;
        } else if(y == 4) {
            if(!judge_gun(a,b+1)) return;
            X = a;
            Y = b+1;
        }
        cnt++;
        GetLocalTime( &sys );
        clip[cnt].start = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
        clip[cnt].x = X;
        clip[cnt].y = Y;
        if(x == 1) {
            clip[cnt].derect = p1.direct;
        } else if(x == 2) {
            clip[cnt].derect = p2.direct;
        }
    }
    void shoot(int x) {
        if(x == 1) {
            create_clip(p1.direct,1,p1.x,p1.y);
        } else if(x == 2) {
            create_clip(p2.direct,2,p2.x,p2.y);
        }
    }
    void clean_clip(int x,int y) {
        locate(x,y*2-1);
        cout<<"  ";
        locate(1,1);
    }
    void print_clip(int x,int y,int i) {
        if(clip[i].flag) {
            clean_clip(x,y);
            return;
        }
        locate(x,y*2-1);
        SetColor(YELLOW);
        cout<<"''";
        locate(1,1);
    //  system("pause");
    }
    void clipmove() {
        GetLocalTime( &sys );
        int t = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
        for(int i = 1; i <= cnt; i++) {
            if(clip[i].flag) continue;
            if(abs(clip[i].start - t) > 50) {
                clip[i].start = t;
                int x = clip[i].x;
                int y = clip[i].y;
                if(clip[i].derect==1) {
                    if(!judge_gun(clip[i].x-1,clip[i].y)) {
                        clip[i].flag = 1;
                        clean_clip(x,y);
                        continue;
                    }
                    clean_clip(clip[i].x,clip[i].y);
                    clip[i].x--;
                    print_clip(clip[i].x,clip[i].y,i);
                } else if(clip[i].derect==2) {
                    if(!judge_gun(clip[i].x,clip[i].y-1)) {
                        clip[i].flag = 1;
                        clean_clip(x,y);
                        continue;
                    }
                    clean_clip(clip[i].x,clip[i].y);
                    clip[i].y--;
                    print_clip(clip[i].x,clip[i].y,i);
                } else if(clip[i].derect==3) {
                    if(!judge_gun(clip[i].x+1,clip[i].y)) {
                        clip[i].flag = 1;
                        clean_clip(x,y);
                        continue;
                    }
                    clean_clip(clip[i].x,clip[i].y);
                    clip[i].x++;
                    print_clip(clip[i].x,clip[i].y,i);
                } else if(clip[i].derect==4) {
                    if(!judge_gun(clip[i].x,clip[i].y+1)) {
                        clip[i].flag = 1;
                        clean_clip(x,y);
                        continue;
                    }
                    clean_clip(clip[i].x,clip[i].y);
                    clip[i].y++;
                    print_clip(clip[i].x,clip[i].y,i);
                }
            }
        }
    }
    void judge_hp() {
        int x = p1.hp;
        int y = p2.hp;
        if(x<0 && y<0 && x > y) swap(x,y);
        if(x <= 0) {
            locate(1,1);
            system("cls");
            printf("GAME OVER!\nTHE WINNER IS P2!");
            Sleep(5000);
            printf("\n-MADE BY Floatiy-");
            exit(0);
        } else if(y <= 0) {
            locate(1,1);
            system("cls");
            printf("GAME OVER!\nTHE WINNER IS P1!");
            Sleep(5000);
            printf("\n-MADE BY Floatiy-");
            exit(0);
        }
    }
    void prog() {
        char ch;
        while(true) {
            if(kbhit()) {
                ch=getch();
                if(ch == 'w' && judge(p1.x-1,p1.y)) {
                    p1.direct = 1;
                    cleanbody(p1.x,p1.y);
                    map[p1.x][p1.y] = 0;
                    putbody(--p1.x,p1.y,1);
                    map[p1.x][p1.y] = 3;
                } else if(ch == '8' && judge(p2.x-1,p2.y)) {
                    p2.direct = 1;
                    cleanbody(p2.x,p2.y);
                    map[p2.x][p2.y] = 0;
                    putbody(--p2.x,p2.y,2);
                    map[p2.x][p2.y] = 3;
                } else if(ch == 'a' && judge(p1.x,p1.y-1)) {
                    p1.direct = 2;
                    cleanbody(p1.x,p1.y);
                    map[p1.x][p1.y] = 0;
                    putbody(p1.x,--p1.y,1);
                    map[p1.x][p1.y] = 3;
                } else if(ch == '4' && judge(p2.x,p2.y-1)) {
                    p2.direct = 2;
                    cleanbody(p2.x,p2.y);
                    map[p2.x][p2.y] = 0;
                    putbody(p2.x,--p2.y,2);
                    map[p2.x][p2.y] = 3;
                } else if(ch == 's' && judge(p1.x+1,p1.y)) {
                    p1.direct = 3;
                    cleanbody(p1.x,p1.y);
                    map[p1.x][p1.y] = 0;
                    putbody(++p1.x,p1.y,1);
                    map[p1.x][p1.y] = 3;
                } else if(ch == '5' && judge(p2.x+1,p2.y)) {
                    p2.direct = 3;
                    cleanbody(p2.x,p2.y);
                    map[p2.x][p2.y] = 0;
                    putbody(++p2.x,p2.y,2);
                    map[p2.x][p2.y] = 3;
                } else if(ch == 'd' && judge(p1.x,p1.y+1)) {
                    p1.direct = 4;
                    cleanbody(p1.x,p1.y);
                    map[p1.x][p1.y] = 0;
                    putbody(p1.x,++p1.y,1);
                    map[p1.x][p1.y] = 3;
                } else if(ch == '6' && judge(p2.x,p2.y+1)) {
                    p2.direct = 4;
                    cleanbody(p2.x,p2.y);
                    map[p2.x][p2.y] = 0;
                    putbody(p2.x,++p2.y,2);
                    map[p2.x][p2.y] = 3;
                } else if(ch == '0') {
                    shoot(2);
                } else if(ch == ' ') {
                    shoot(1);
                }
                Sleep(20);
            }
            clipmove();
            judge_hp();
        }
    }
    void welcome() {
        printf("操作方法:\n玩家1 wasd控制移动,空格攻击\n玩家2 数字小键盘4568控制移动,0攻击\n");
        Sleep(2000);
    }
    int main() {
        welcome();
        GetLocalTime( &sys );
        init();
        prog();
        return 0;
    }
    
    小游戏
    #include<iostream>
    #include<string>
    #include<cstdlib>
    #include<windows.h>
    #include<ctime>
    #include<conio.h>
    #include<cstdio>
    using namespace std;
     
    class Tetris
    {
    private:
      int rank;        //游戏难度等级
      int score;        // 得分
      int id;          //图形ID
      int point[2];      //两基点
      int top;          //最高点高度
    public:
      Tetris();
      void Welocme();      //首界面
      void DrawMap();      //游戏界面
      void SetColor(int);    //控制颜色
      void Draw(int, int, int);    //画图形
      void Run();        //运行游戏
      void ReDraw(int, int, int);      //清除图形
      bool Judge(int, int, int);
      void Turn(int);        //旋转
      void Updata();        // 更新界面
      void Pause();        //游戏暂停
      void Input_score();
    };
     
    const int sharp[15][8] =          //组成图形的各个点的各个坐标,先纵后横
    {
    {0,0,1,0,2,0,3,0},{0,0,0,1,0,2,0,3},
    {0,0,1,0,0,1,1,1},
    {0,0,1,0,1,1,1,2},{0,1,1,1,2,0,2,1},{0,0,0,1,0,2,1,2},{0,0,0,1,1,0,2,0},
    {1,0,1,1,1,2,0,2},{0,0,0,1,1,1,2,1},{0,0,0,1,0,2,1,0},{0,0,1,0,2,0,2,1},
    {0,0,0,1,1,1,1,2},{0,1,1,0,1,1,2,0},
    {0,1,0,2,1,0,1,1},{0,0,1,0,1,1,2,1}
    };
     
    const int high[15] = { 4,1,2,2,3,2,3,2,3,2,3,2,3,2,3 };
    int map[28][16];
     
    #define a1  0      //条形
    #define a2  1
    #define b 2          // 方块
     
    #define c1 3          //L形
    #define c2 4
    #define c3 5
    #define c4 6
     
    #define d1 7          //T形
    #define d2 8 
    #define d3 9
    #define d4 10
     
    #define e1 11        //闪电1形
    #define e2 12
     
    #define f1 13        //闪电2形
    #define f2 14
     
    Tetris::Tetris()        //构造函数, 初始化各个值
    {
      point[0] = 0;
      point[1] = 5;
      score = 0;
      top = 25;
    }
     
    void Tetris::Turn(int num)        //旋转函数
    {
      switch (num)
      {
      case a1: id = a2; break;          //条形互换
      case a2: id = a1; break;
     
      case b: id = b; break;          //方块无法旋转
     
      case c1: id = c2; break;          //各种L形互换
      case c2: id = c3; break;
      case c3: id = c4; break;
      case c4: id = c1; break;
     
      case d1: id = d2; break;          //各种T形互换
      case d2: id = d3; break;
      case d3: id = d4; break;
      case d4: id = d1; break;
     
      case e1: id = e2; break;          //两种闪电形互换
      case e2: id = e1; break;
     
      case f1: id = f2; break;
      case f2: id = f1; break;
      }
    }
     
    void SetPos(int i, int j)      //控制光标位置, 列, 行
    {
      COORD pos = { i,j };
      SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
    }
     
    void Tetris::Pause()        // 暂停函数
    {
      SetPos(32, 10);
      cout << "游戏暂停!" << endl;
      SetPos(30, 11);
      cout << "你的分数为 " << score;
      char temp;
      while (1)
      {
        while (1)
        {
          if (_kbhit())
          {
            temp = _getch();
            break;
          }
        }
        if (temp == 32)
          break;
      }
      SetPos(32, 10);          // 清除暂停时显示的信息
      cout << "         ";
      SetPos(30, 11);
      cout << "              ";
    }
     
    void Tetris::Updata()          //更新函数
    {
      int i, flag;
      int nx, ny;
      for (i = 0; i < 4; i++)
      {
        nx = point[0] + sharp[id][i * 2];
        ny = point[1] + sharp[id][i * 2 + 1];
        SetPos((ny + 1) * 2, nx + 1);
        SetColor(0);
        cout << "■";
        map[nx][ny] = 1;          //界面各个点是否为空的更新
      }
     
      if (point[0] < top)
        top = point[0];          //最高点的更新
     
      for (i = point[0]; i < point[0] + high[id]; i++)      //消除行
      {
        flag = 1;
        for (int j = 0; j < 13; j++)          //判定某一行是否满, 用flag来标记
          if (map[i][j] == 0)
            flag = 0;
        if (flag == 1)
        {
          for (int k = i; k >= top; k--)
          {
            for (int p = 0; p < 13; p++)
            {
              map[k][p] = map[k - 1][p];
              SetPos((p + 1) * 2, k + 1);
              if (map[k][p] == 1)
                cout << "■";
              else cout << " ";
     
            }
          }
          score += 10;
          Input_score();
        }
      }
    }
     
    void Tetris::Input_score()
    {
      SetColor(3);
      SetPos(30, 19);
      cout << "得分: " << score;
    }
     
    void Tetris::Welocme()      //欢迎界面
    {
      SetColor(1);
      char x;
      while (1)
      {
        system("cls");
        cout << "■■■■■■■■■■■■■■■■■■■■■" << endl;
        cout << "    俄罗斯方块    " << endl;
        cout << "■■■■■■■■■■■■■■■■■■■■■" << endl;
        cout << "    操作方式:" << endl;
        cout << "    ↑ - 旋转" << endl;
        cout << "    ↓ - 加速下移" << endl;
        cout << "    ← - 左移" << endl;
        cout << "    → - 右移" << endl;
        cout << "    空格 - 暂停" << endl;
        cout << "■■■■■■■■■■■■■■■■■■■■■" << endl;
        cout << "■ 按1—3选择难度■" << endl;
        SetPos(20, 10);
        x = getchar();
        if (x <= '9' && x >= '0')
        {
          rank = x - '0';
          break;
        }
      }
    }
     
    void Tetris::SetColor(int color_num)      //设置颜色
    {
      int n;
      switch (color_num)
      {
      case 0: n = 0x08; break;
      case 1: n = 0x0C; break;
      case 2: n = 0x0D; break;
      case 3: n = 0x0E; break;
      case 4: n = 0x0A; break;
      }
      SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), n);
    }
     
    void Tetris::DrawMap()        //画游戏时界面
    {
      int i;
      SetColor(0);
     
      for (i = 0; i < 24; i++)    //宽24格
      {
        SetPos(i * 2, 0);
        cout << "■";
        SetPos(i * 2, 26);
        cout << "■";
      }
     
      for (i = 0; i < 26; i++)    //高26格
      {
        SetPos(0, i);
        cout << "■";
        SetPos(28, i);
        cout << "■";
        SetPos(46, i);
        cout << "■";
      }
     
      for (i = 14; i < 24; i++)
      {
        SetPos(i * 2, 16);
        cout << "■";
      }
     
      SetColor(3);
      Input_score();
      SetPos(30, 21);
      cout << "难度等级: " << rank;
      SetPos(32, 2);
      cout << "下一图形";
    }
     
    void Tetris::Draw(int x, int y, int num)        //画图形
    {
      int nx, ny;
     
      for (int i = 0; i < 4; i++)
      {
        nx = x + sharp[num][2 * i];
        ny = y + sharp[num][2 * i + 1];
        SetPos((ny + 1) * 2, nx + 1);
        SetColor(i + 1);
        cout << "■";
      }
    }
     
    void Tetris::ReDraw(int x, int y, int num)        //为更新图形的位置清除图形
    {
      int nx, ny;
      
      for (int i = 0; i < 4; i++)
      {
        nx = x + sharp[num][2 * i];
        ny = y + sharp[num][2 * i + 1];
        SetPos((ny + 1) * 2, nx + 1);
        cout << " ";
      }
    }
     
    bool Tetris::Judge(int x, int y, int num)        //判定在x, y 所指位置是否可画编号为
    {                          //num 的图形, 若不可画则反回true
      int nx, ny;
      for (int i = 0; i < 4; i++)
      {
        nx = x + sharp[num][2 * i];
        ny = y + sharp[num][2 * i + 1];
        if (!(nx < 25 && nx >= 0 && ny < 13 && ny >= 0 && !map[nx][ny]))
          return true;
      }
      return false;
    }
     
    void Tetris::Run()          //运行游戏
    {
      int next_id;
      srand((int)time(0));
     
      id = rand() % 15;
      next_id = rand() % 15;
     
      Draw(point[0], point[1], id);
      Draw(5, 16, next_id);
     
      int count;
      if (rank == 1)
        count = 150;
      else if (rank == 2)
        count = 100;
      else if (rank==3)
        count = 50;
      else
        count = 5;
      int i = 0;  //不同等级对应不同count
     
      while (1)
      {
        if (!(i < count))        //i 与 count 用于控制时间
        {
          i = 0;
          if (Judge(point[0] + 1, point[1], id))      //在某一位置不能下落的话
          {
            Updata();
            id = next_id;
     
            ReDraw(5, 16, next_id);
            next_id = rand() % 15;
     
            point[0] = 0; point[1] = 5;
            Draw(point[0], point[1], id);
            Draw(5, 16, next_id);
     
            if (Judge(point[0], point[1], id))
            {
              system("cls");
              SetPos(20, 10);
              cout << "游戏结束!" << endl;
              SetPos(20, 11);
              cout << "你的分数为 " << score << endl;
              system("pause");
              exit(1);
            }
          }
          else          //继续下落
          {
            ReDraw(point[0], point[1], id);
            point[0]++;
            Draw(point[0], point[1], id);
          }
        }
     
        if (_kbhit())        //键盘输入值时 
        {
          int key, key2;
          key = _getch();
          if (key == 224)
          {
            key2 = _getch();
     
            if (key2 == 72)      //按向上方向键时
            {
              int temp = id;
              Turn(id);
              if (Judge(point[0], point[1], id))
                id = temp;
              ReDraw(point[0], point[1], temp);
              Draw(point[0], point[1], id);
            }
            if (key2 == 80)        //按向下方向键时
            {
              if (!Judge(point[0] + 2, point[1], id))
              {
                ReDraw(point[0], point[1], id);
                point[0] += 2;
                Draw(point[0], point[1], id);
              }
            }
            else if (key2 == 75)        //按向左方向键时
            {
              if (!Judge(point[0], point[1] - 1, id))
              {
                ReDraw(point[0], point[1], id);
                point[1]--;
                Draw(point[0], point[1], id);
              }
            }
            else if (key2 == 77)          //按向右方向键时
            {
              if (!Judge(point[0], point[1] + 1, id))
              {
                ReDraw(point[0], point[1], id);
                point[1]++;
                Draw(point[0], point[1], id);
              }
            }
          }
          else if (key == 32)          // 按下空格暂停
            Pause();
        }
     
        Sleep(1);    //等待1毫秒
        i++;        //控制下落间隔
      }
    }
     
    int main()
    {
      Tetris game;
      game.Welocme();
      system("cls");        //清除欢迎界面
      game.DrawMap();
      game.Run();
    }
    
    孤勇者(字幕版)
    #include<bits/stdc++.h>
    #include <windows.h>
    #pragma GCC optimize(3)
    #pragma GCC target("avx,sse2,sse3,sse4,mmx")
    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("inline")
    #pragma GCC optimize("-fgcse")
    #pragma GCC optimize("-fgcse-lm")
    #pragma GCC optimize("-fipa-sra")
    #pragma GCC optimize("-ftree-pre")
    #pragma GCC optimize("-ftree-vrp")
    #pragma GCC optimize("-fpeephole2")
    #pragma GCC optimize("-ffast-math")
    #pragma GCC optimize("-fsched-spec")
    #pragma GCC optimize("unroll-loops")
    #pragma GCC optimize("-falign-jumps")
    #pragma GCC optimize("-falign-loops")
    #pragma GCC optimize("-falign-labels")
    #pragma GCC optimize("-fdevirtualize")
    #pragma GCC optimize("-fcaller-saves")
    #pragma GCC optimize("-fcrossjumping")
    #pragma GCC optimize("-fthread-jumps")
    #pragma GCC optimize("-funroll-loops")
    #pragma GCC optimize("-fwhole-program")
    #pragma GCC optimize("-freorder-blocks")
    #pragma GCC optimize("-fschedule-insns")
    #pragma GCC optimize("inline-functions")
    #pragma GCC optimize("-ftree-tail-merge")
    #pragma GCC optimize("-fschedule-insns2")
    #pragma GCC optimize("-fstrict-aliasing")
    #pragma GCC optimize("-fstrict-overflow")
    #pragma GCC optimize("-falign-functions")
    #pragma GCC optimize("-fcse-skip-blocks")
    #pragma GCC optimize("-fcse-follow-jumps")
    #pragma GCC optimize("-fsched-interblock")
    #pragma GCC optimize("-fpartial-inlining")
    #pragma GCC optimize("no-stack-protector")
    #pragma GCC optimize("-freorder-functions")
    #pragma GCC optimize("-findirect-inlining")
    #pragma GCC optimize("-fhoist-adjacent-loads")
    #pragma GCC optimize("-frerun-cse-after-loop")
    #pragma GCC optimize("inline-small-functions")
    #pragma GCC optimize("-finline-small-functions")
    #pragma GCC optimize("-ftree-switch-conversion")
    #pragma GCC optimize("-foptimize-sibling-calls")
    #pragma GCC optimize("-fexpensive-optimizations")
    #pragma GCC optimize("-funsafe-loop-optimizations")
    #pragma GCC optimize("inline-functions-called-once")
    #pragma GCC optimize("-fdelete-null-pointer-checks")
    
    using namespace std;
    
    int getvoice(int s) {
    	if (s == 0) return 0;
    	if (s == -1) return 262;
    	if (s == -2) return 294;
    	if (s == -3) return 330;
    	if (s == -4) return 349;
    	if (s == -5) return 392;
    	if (s == -6) return 440;
    	if (s == -7) return 493;
    	if (s == 1) return 532;
    	if (s == 2) return 578;
    	if (s == 3) return 659;
    	if (s == 4) return 698;
    	if (s == 5) return 784;
    	if (s == 6) return 880;
    	if (s == 7) return 988;
    	if (s == 10) return 1046;
    	if (s == 20) return 1175;
    	if (s == 30) return 1318;
    	if (s == 40) return 1480;
    	if (s == 50) return 1568;
    	if (s == 60) return 1760;
    	if (s == 70) return 1976;
    }
    
    int gettime(int s) {
    	if (s == 4) return 1600;
    	if (s == 3) return 1200;
    	if (s == 2) return 800;
    	if (s == 1) return 500;
    	if (s == 10) return 750;
    	if (s == -2) return 400;
    	if (s == -20) return 600;
    	if (s == -4) return 200;
    	if (s == -40) return 300;
    	if (s == -8) return 50;
    	if (s == -80) return 75;
    }
    
    int prevoice[5] = {2, -7, 1, -6}, pretime[5] = {-4, -4, -4, -4};
    int para1voice[50] = {3, 0, 0, 1, 2, 1, 3, 0, 1, 2, 1, 2, 3, -6, 1, -6, 1, -6, 1, 2, 1, -7, 0, 0, 3, 0, 0, 1, 2, 1, 3, 0, 1, 2, 1, 2, 3, -6, 1, -6, 1, -6, 1, 3, 2, -7, 0, 0}, para1time[50] = {2, 1, -4, -4, -4, -4, 2, -20, -4, -4, -4, -4, -4, -20, -4, -20, -4, -20, -4, -2, -2, 2, 1, 1, 2, 1, -4, -4, -4, -4, 2, -20, -4, -4, -4, -4, -4, -20, -4, -20, -4, -20, -4, -2, -2, 2, 1, 1}; 
    int para2voice[80] = {-6, 1, 6, 6, 6, 6, 5, 6, 6, 5, 6, 5, 6, 5, 3, 3, 3, 0, 0, -6, 1, 6, 6, 6, 5, 6, 5, 7, 7, 7, 6, 7, 7, 6, 3, 3, 0, 3, 5, 3, 2, 3, 2, 3, 2, 3, 5, 3, 5, 3, 2, 3, 2, 3, 2, 0, 1, 2, 3, -6, 1, 3, 2, 3, 2, 1, 1, -6, 0, 0}, para2time[80] = {-4, -4, -2, -4, -4, -4, -4, -2, -4, -4, -4, -4, -4, -4, -4, -2, 1, 1, -2, -4, -4, -2, -4, -4, -4, -4, -4, -20, -4, -4, -4, -2, -4, -2, -4, 2, -4, -4, -4, -4, -20, -4, -20, -4, -20, -4, -4, -4, -4, -4, -20, -4, -20, -4, 1, -2, -4, -4, -2, -2, -2, -2, -20, -4, -4, -4, -2, 2, 1, -2};
    int para3voice[120] = {6, 7, 10, 20, 7, 10, 10, 10, 7, 10, 20, 7, 10, 10, 10, 20, 30, 20, 30, 20, 30, 30, 20, 30, 50, 30, 6, 7, 10, 20, 7, 10, 10, 10, 7, 10, 20, 7, 10, 10, 10, 20, 30, 20, 30, 20, 30, 30, 20, 30, 50, 30, 50, 30, 50, 30, 50, 30, 50, 60, 30, 50, 50, 30, 50, 30, 50, 30, 50, 60, 30, 50, 50, 50, 30, 20, 20, 20, 10, 30, 30, 20, 20, 20, 10, 10, 6, 0, 0, 50, 50, 30, 20, 20, 20, 10, 30, 30, 20, 20, 20, 10, 10, 6, 0, 0, 0, 0}, para3time[120] = {-4, -4, -4, -4, -4, -4, -2, -4, -4, -4, -4, -4, -4, -2, -4, -4, -4, -4, -4, -4, -2, -4, -4, -2, -2, -2, -4, -4, -4, -4, -4, -4, -2, -4, -4, -4, -4, -4, -4, -2, -4, -4, -4, -4, -4, -4, -2, -4, -4, -2, -2, -2, -2, -20, -4, -20, -4, -4, -4, -4, -4, -2, -2, -20, -4, -20, -4, -4, -4, -4, -4, -2, -4, -4, -4, -4, -2, -2, -4, -4, -4, -4, -2, -2, -4, -4, 2, 1, -2, -4, -4, -4, -4, -2, -2, -4, -4, -4, -4, -2, -2, -4, -4, 2, 1, 1, 1, 1}; 
    int para4voice[80] = {6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 5, 6, 5, 6, 5, 3, 3, 3, 0, 0, 6, 5, 6, 5, 6, 5, 6, 5, 7, 7, 7, 6, 7, 6, 3, 3, 3, 0, 0, 3, 5, 3, 2, 3, 2, 3, 2, 3, 5, 3, 5, 3, 2, 3, 2, 3, 2, 0, 1, 2, 3, 6, 10, 30, 20, 30, 20, 10, 10, 6, 0}, para4time[80] = {-4, -4, -20, -4, -4, -4, -4, -4, -2, -4, -4, -4, -4, -4, -4, -4, -20, 1, 1, -2, -4, -4, -2, -4, -4, -4, -4, -4, -20, -4, -4, -4, -4, -4, -4, -2, 1, 1, -4, -4, -4, -4, -20, -4, -20, -4, -20, -4, -4, -4, -4, -4, -20, -4, -20, -4, 1, -2, -4, -4, -2, -2, -2, -2, -20, -4, -4, -4, -2, 3, -2};
    int para5voice[30] = {-6, 1, 3, 7, 7, 7, 7, 6, 5, 5, 0, 6, -6, 1, 3, 7, 7, 7, 7, 6, 5, 5, 0}, para5time[30] = {-2, -2, -2, 1, -2, -4, -4, -4, -20, 3, -2, -2, -2, -2, 1, -2, -4, -4, -4, -20, 2, -2};
    string p1name[60] = {"都,", "", "是", "勇", "敢", "的。", "你", "额", "头", "的", "伤", "口,", "你", "的", "不", "同,", "你", "犯", "的", "错。", "", "", "", "都,", "", "不", "必", "隐", "藏。", "", "", "你", "破", "旧", "的", "玩", "偶,", "你", "的", "面", "具,", "你", "的", "自", "我。", "", "", ""};
    string p2name[80] = {"他", "们", "说,", "要", "带", "着", "光,", "", "驯", "服", "每", "一", "头", "怪", "兽。", "", "", "", "", "他", "们", "说,", "", "要", "缝", "好", "你", "的", "伤,", "没", "有", "人", "爱", "小", "丑。", "你", "的", "不", "同,", "你", "的", "光", "荣,", "人", "只", "有", "不", "完", "美", "值", "得", "歌", "颂。", "", "谁", "说", "污", "泥", "", "满", "身", "的", "", "不", "算", "英", "雄?", "", "", "", "", "", "", ""};
    string p3name[120] = {"爱", "你", "孤身", "走", "暗", "巷,", "爱", "你", "不跪", "的", "模", "样。", "爱", "你", "对", "持", "过", "绝", "望,", "不", "肯", "哭", "一", "场!", "爱", "你", "破烂", "的", "衣", "裳,", "却", "敢", "赌", "命", "运", "的", "枪。", "爱", "你", "和", "我", "那", "么", "像,", "缺", "口", "都", "一", "样!", "", "去", "吗?", "配", "吗?", "这", "褴", "褛", "的", "披", "风。", "战", "吗?", "战", "啊!", "以", "最", "卑", "微", "的", "梦。", "致", "那", "黑", "", "", "夜", "中", "的", "", "呜", "", "咽", "与", "怒", "吼。", "", "", "", "谁", "说", "", "", "站", "在", "", "光", "里", "的", "", "才", "算", "英", "雄!", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
    string p4name[80] = {"他", "们", "说,", "要", "戒", "了", "你", "", "的", "狂,", "就", "像", "擦", "掉", "了", "污", "垢。", "", "", "", "", "他", "们", "说,", "要", "顺", "台", "阶", "而", "上,", "而", "代", "价", "是", "低", "头。", "", "那", "就", "让", "我", "不", "可", "乘", "风,", "", "也", "一", "样", "骄", "傲", "着", "那", "种", "孤", "勇。", "", "谁", "说", "对", "弈", "平", "凡", "的", "", "不", "算", "英", "雄!"};
    string p5name[30] = {"你", "的", "怒", "吼,", "", "与", "众", "不", "同!", "", "", "你", "的", "沉", "默,", "", "震", "耳", "欲", "聋!", ""}; 
    string p23name[120] = {"爱", "你", "孤身", "走", "暗", "巷,", "爱", "你", "不跪", "的", "模", "样。", "爱", "你", "对", "持", "过", "绝", "望,", "不", "肯", "哭", "一", "场!", "爱", "你", "来自", "于", "蛮", "荒,", "一", "生", "不", "借", "谁", "的", "狂。", "你", "将", "造", "你", "的", "城", "邦,", "在", "废", "墟", "之", "上!", "", "去", "吗?", "去", "啊!", "以", "最", "卑", "微", "的", "梦。", "战", "吗?", "战", "啊!", "以", "最", "孤", "高", "的", "梦。", "致", "那", "黑", "", "", "夜", "中", "的", "", "呜", "", "咽", "与", "怒", "吼。", "", "", "", "谁", "说", "", "", "站", "在", "", "光", "里", "的", "", "才", "算", "英", "雄!", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
    
    void pre() {
    	for (int i = 1; i <= 10; i++)
    	{
    		for (int j = 0; j < 4; j++)
    		{
    			Beep(getvoice(prevoice[j]), gettime(pretime[j]));
    		}
    	}
    }
    
    void para1() {
    	for (int j = 0; j < 48; j++)
    	{
    		Beep(getvoice(para1voice[j]), gettime(para1time[j]));
    		cout << p1name[j];
    		if(j == 5 || j == 11 || j == 15 || j == 19 || j == 28 || j == 36 || j == 40 || j == 44)
    		{
    			cout << endl;
    		}
    	}
    }
    
    void para2() {
    	for (int j = 0; j < 70; j++)
    	{
    		Beep(getvoice(para2voice[j]), gettime(para2time[j]));
    		cout << p2name[j];
    		if(j == 7 || j == 18 || j == 28 || j == 34 || j == 42 || j == 52 || j == 66)
    		{
    			cout << endl;
    		}
    	}
    }
    
    void para3() {
    	for (int j = 0; j < 108; j++)
    	{
    		Beep(getvoice(para3voice[j]), gettime(para3time[j]));
    		cout << p3name[j];
    		if(j == 5 || j == 11 || j == 18 || j == 23 || j == 29 || j == 36 || j == 43 || j == 48 || j == 53 || j == 59 || j == 63 || j == 69 || j == 84 || j == 103)
    		{
    			cout << endl;
    		}
    	}
    }
    
    void para4() {
    	for (int j = 0; j < 71; j++)
    	{
    		Beep(getvoice(para4voice[j]), gettime(para4time[j]));
    		cout << p4name[j];
    		if(j == 9 || j == 16 || j == 29 || j == 35 || j == 44 || j == 55 || j == 68)
    		{
    			cout << endl;
    		}
    	}
    }
    
    void para5() {
    	for (int j = 0; j < 22; j++)
    	{
    		Beep(getvoice(para5voice[j]), gettime(para5time[j]));
    		cout << p5name[j];
    		if(j == 8 || j == 19)
    		{
    			cout << endl;
    		}
    	}
    }
    
    void para23() {
    	for (int j = 0; j < 108; j++)
    	{
    		Beep(getvoice(para3voice[j]), gettime(para3time[j]));
    		cout << p23name[j];
    		if(j == 5 || j == 11 || j == 18 || j == 23 || j == 29 || j == 36 || j == 43 || j == 48 || j == 53 || j == 59 || j == 63 || j == 69 || j == 84 || j == 103)
    		{
    			cout << endl;
    		}
    	}
    }
    
    int main() {
    	while(1)
    	{ 
    		pre();
    		para1();
    		para2();
    		para3();
    		para4();
    		para3();
    		para5();
    		para23();
    		Sleep(10000);
    	}
    	return 0;
    }
    

    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

    老师到达战场,返回作业


    暂存区