跳到正文

个人记录

出题/配置题目

Super26Th_约 4 分钟
原文
文章信息与版本

文章信息

发布
2026年3月26日
收录
2026年3月26日
更新
2026年11月11日
篇幅
约 4 分钟

版本

  1. v3当前
  2. v2
  3. v1

制作题目配置文件

就是生成 config.yml。

c++ 程序已被淘汰,前往以下网页制作: https://thchfhch1.github.io/tool/TestCaseManager.html

清除\r\n

待更新。

dos2unix.cpp

C++
#include <cstdio>

const int SIZE = 100000000;
char buf[SIZE];

int main(int, char *argv[]) {
	std::FILE *fin = std::fopen(argv[1], "r");
	std::size_t cnt = std::fread(buf, sizeof(char), SIZE, fin);
	std::fclose(fin);
	std::FILE *fout = std::fopen(argv[1], "wb");
	std::fwrite(buf, sizeof(char), cnt, fout);
	std::fclose(fout);
	return 0;
}

work.cpp

C++
#include<bits/stdc++.h>
#include<fstream>
using namespace std;
#define For(i,t,n) for(int i=t;i<=n;++i)
#define foR(i,t,n) for(int i=t;i>=n;--i)

int n=25;
stringstream op;

void solve(){
    For(i,1,n){
    	op<<"dos2unix.exe data/"<<i<<".in";
    	string in1; getline(op,in1);
    	system(in1.c_str());
    	cerr<<in1<<'\n';
    	op.clear();
    	op<<"dos2unix.exe data/"<<i<<".out";
    	string out1; getline(op,out1);
    	system(out1.c_str());
    	cerr<<out1<<'\n';
    	op.clear();
	}
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	solve();
	return 0;
}
C++
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>

using namespace std;

int main()
{
    int cnt[] = {3, 7, 7, 5, 2, 15};
    char buf[256];

    for (int sub = 1; sub <= 6; ++sub)
    {
        int max_idx = cnt[sub - 1];
        for (int i = 1; i <= max_idx; ++i)
        {
            // 拼接文件名 subX_Y.in
            sprintf(buf, "sub%d_%d.in", sub, i);
            string fn(buf);

            string cmd = "dos2unix.exe " + fn;
            cout << cmd << endl;
            system(cmd.c_str());

            // 如果需要同时处理 .out 文件,打开下面这段
            /*
            sprintf(buf, "sub%d_%d.out", sub, i);
            string fn_out(buf);
            string cmd_out = "dos2unix.exe " + fn_out;
            cout << cmd_out << endl;
            system(cmd_out.c_str());
            */
        }
    }
    return 0;
}
原文