zoukankan      html  css  js  c++  java
  • 對拍

    我们假定您已经阅读了右侧详细的博客: 戳我

    本文仅限于Windows系统下讨论。

    0. 数据生成

      可以暴力rand,也可以卡到数据范围顶部。

      例:

    #include<stdio.h>
    #include<windows.h>
    #include<time.h> signed main(){ srand(time(NULL)); printf("%d %d ",rand(),rand()); }

    1. 打正解

      例:

    int main(){}

    2. 打暴力

      例:

    signed main(){}
    

    3. 对拍程序

    由于C with STL 的文件重定向太麻烦,我们用 BAT 

    首先,bat很好写

    然后,我们就可以写出它。

      例:

    @echo off
    :loop
        数据生成程序.exe > input.txt
        正解.exe < input.txt > output1.txt
        暴力.exe < input.txt > output2.txt
        fc output1.txt output2.txt
    if not errorlevel 1 goto loop
    pause
    goto loop
    end
    

      而且为了养成一遍ac的习惯,还可以使用以下程序。

    @echo off
    :loop
        数据生成程序.exe > input.txt
        正解.exe < input.txt > output1.txt
        暴力.exe < input.txt > output2.txt
        fc output1.txt output2.txt
    if not errorlevel 1 goto loop
    shutdown -s -t 0
    goto loop
    end

    4. 时间控制

      调用clock函数,可知道某一段语句内程序运行的时间。分度值为1ms。

      例:

    #include<stdio.h>
    #include<time.h>
    signed main(){
        clock_t start;
        float fuck=clock();
        printf("shit!
    ");
        printf("%f
    ",clock()-fuck);
    }

    5. 空间控制

      手算。

    6. 是否能A

      显然,和自己对拍。再把它交上去。

      然后,就过了!

  • 相关阅读:
    JS键盘码值表
    JS入门笔记
    CSS居中的方法总结
    CSS布局模型思考
    条件、循环、函数定义、字符串操作练习
    Python输入输出练习,运算练习,turtle初步练习
    如何理解Comparator接口中的升降序?
    12个非常实用的JavaScript小技巧
    JAVA泛型知识(一)
    开窗函数简介
  • 原文地址:https://www.cnblogs.com/monyhzc/p/11227043.html
Copyright © 2011-2022 走看看