关于用 c++ 对拍时时间的问题
  • 板块学术版
  • 楼主Micnation_AFO
  • 当前回复5
  • 已保存回复5
  • 发布时间2021/12/4 07:33
  • 上次更新2023/11/3 23:01:42
查看原帖
关于用 c++ 对拍时时间的问题
574944
Micnation_AFO楼主2021/12/4 07:33

目前使用的代码:

#include <bits/stdc++.h>
using namespace std;

int main() {
	for (int T = 1; T <= 1000; T++) {
		system("C:\\Users\\Administrator\\Desktop\\dp\\random.exe");
		double st = clock();
		system("C:\\Users\\Administrator\\Desktop\\dp\\sol.exe");
		double ed = clock();
		system("C:\\Users\\Administrator\\Desktop\\dp\\bf.exe");
		if (system("fc C:\\Users\\Administrator\\Desktop\\dp\\tree.out C:\\Users\\Administrator\\Desktop\\dp\\tree.ans")) {
			cout << "Wrong Answer" << endl;
			return 0;
		}
		else printf("Accepted, 测试点 #%d, 用时 %.0lfms\n", T, ed-st);
	}
	return 0;
}

于是我试了一下 n=1000 左右的数据与 n=5 左右的小数据,结果前者的时间大约是几十ms,而后者竟然几百ms?

2021/12/4 07:33
加载中...