码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 对拍系列 v1.0


    效果图:在这里插入图片描述

    代码实现:

    #include 
    #include 
    #include 
    
    using namespace std;
    
    char _1[10], _2[10];
    
    int main()
    {
    //  freopen ("xx.out", "w", stdout);
      srand(time(0));
      HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
      system("g++ your-code.cpp -o a.exe -std=c++14 -g");
      system("g++ answer.cpp -o b.exe -std=c++14 -g");
      system("g++ maker.cpp -o c.exe -std=c++14 -g");
      int score = 0;
      const int tle = 200;
      for (int ca = 1; ca <= 25; ca++)
      {
    //    system("color 0f");
        SetConsoleTextAttribute(hConsole, 7);
    //    fprintf (stderr, "Running On Test %d: \n", ca);
        srand(time(0));
        system("c.exe");
    //    Sleep(666);
        errno = 0;
        clock_t st = clock();
        system("a.exe < sample.in > your-code.out");
        clock_t ed = clock();
        if (errno)
        {
          SetConsoleTextAttribute(hConsole, 13);
          fprintf (stderr, "R Run Time Error On Test #%d\n", ca);
        }
        double ut = ed - st;
        if (ut > tle) {
          SetConsoleTextAttribute(hConsole, 9);
          fprintf (stderr, "T Time Limit Exceed On Test #%d\n", ca);
        }
        system("b.exe < samp.in > answer.out");
        if (system("fc your-code.out answer.out"))
        {
    //      system("color 07");
          ae:;
          SetConsoleTextAttribute(hConsole, 4);
          fprintf (stderr, "× Wrong Answer On Test #%d, your answer is %s, expect %s\n", ca, _1, _2);
        }
        else
        {
          af:;
    //      system("color 0a");
          SetConsoleTextAttribute(hConsole, 10);
          fprintf (stderr, "√ Accepted On Test #%d\n", ca);
          score += 4;
        }
    //    Sleep(1000);
      }
      fprintf (stderr, "Score = %d", score);
      return 0;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61

    下一期预告:判断MLE错误。

    凑字数凑字数凑字数凑字数
    凑字数凑字数凑字数凑字数
    凑字数凑字数凑字数凑字数
    凑字数凑字数凑字数凑字数
    凑字数凑字数凑字数凑字数
    凑字数凑字数凑字数凑字数
    凑字数凑字数凑字数凑字数
    凑字数凑字数凑字数凑字数
    凑字数凑字数凑字数凑字数
    凑字数凑字数凑字数凑字数

  • 相关阅读:
    领域驱动设计:领域模型与代码模型的一致性
    身为程序员哪一个瞬间让你最奔溃 ?
    构建高效且可伸缩的结果缓存
    家政服务小程序:打造便捷生活,让家政服务触手可及
    冥想第五百一十六天
    C++中GDAL批量创建多个栅格图像文件并批量写入数据
    2022年第一季度保险服务数字化跟踪分析
    Linux 内存管理 pt.2
    MongoDB从入门到实战之.NET Core使用MongoDB开发ToDoList系统(8)-Ant Design Blazor前端框架搭建
    常用API
  • 原文地址:https://blog.csdn.net/lxylluvio/article/details/126609626
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号