跳到正文

个人记录

造题相关

Super26Th_约 4 分钟
原文

这是 2026年3月26日 存档的第 2 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

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

版本

  1. v3当前
  2. v2
  3. v1
清除\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: "<<in1<<'\n';
    	op.clear();
    	op<<"dos2unix.exe data/"<<i<<".out";
    	string out1; getline(op,out1);
    	system(out1.c_str());
    	cerr<<"out1: "<<out1<<'\n';
    	op.clear();
	}
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	solve();
	return 0;
}
一键制作题目配置文件

就是生成 config.yml。

C++
#include<bits/stdc++.h>
using namespace std;
#define il inline
typedef long long LL;
typedef unsigned long long ULL;
//#define int LL
typedef const int& ci;
#define For(i,t,n) for(int i=t;i<=n;++i)
#define foR(i,t,n) for(int i=t;i>=n;--i)
const int inf=0x3f3f3f3f;
const int MAXN=1e5+5;

int n,sc,tl,ml,l,r;
string fn="";

void solve(){
    cerr<<"tot: ";cin>>n;
//    cerr<<"filename: ";cin>>fn;
    For(id,1,n){
    	cerr<<"case #"<<id<<" >\n";
    	cerr<<"range[l,r]: "; cin>>l>>r;
    	cerr<<"score: "; cin>>sc;
    	cerr<<"timeLimit/ms: "; cin>>tl;
    	cerr<<"memoryLimit/MB: "; cin>>ml;
    	For(i,l,r){
    		cout<<fn<<i<<".in:\n";
    		cout<<"  timeLimit: "<<tl<<'\n';
    		cout<<"  memoryLimit: "<<ml*1024<<'\n';
    		cout<<"  score: "<<sc<<'\n';
    		cout<<"  subtaskId: "<<id<<'\n';
		}
		cerr<<'\n';
	}
}

signed main(){
	freopen("config.yml","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	solve();
	return 0;
}