跳到正文

剪贴板

剪贴板 ablr3554

原文
剪贴板信息

剪贴板信息

收录
更新

随机种子获取:std::chrono::high_resolution_clock::now().time_since_epoch().count()。

Windows:

C++
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int main()
{
	register int k = 0;
	while (1)
	{
		k++;
		string s = "title Testing the ";
		if (k >= 1000000000) s += (k / 1000000000 % 10 + '0');
		if (k >= 100000000) s += (k / 100000000 % 10 + '0');
		if (k >= 10000000) s += (k / 10000000 % 10 + '0');
		if (k >= 1000000) s += (k / 1000000 % 10 + '0');
		if (k >= 100000) s += (k / 100000 % 10 + '0');
		if (k >= 10000) s += (k / 10000 % 10 + '0');
		if (k >= 1000) s += (k / 1000 % 10 + '0');
		if (k >= 100) s += (k / 100 % 10 + '0');
		if (k >= 10) s += (k / 10 % 10 + '0');
		s += (k % 10 + '0');
		s += "th test case";
		system(s.c_str());
		system("data.exe > in");
		putchar('.');
		system("tj.exe < in > ans");
		putchar('.');
		system("me.exe < in > out");
		putchar('.');
		putchar('\n');
		if (system("fc out ans"))
		{
        	system("echo input:");
        	system("type in");
			putchar('W');
			putchar('r');
			putchar('o');
			putchar('n');
			putchar('g');
			break;
		}
		#if 1
			system("echo input:");
			system("type in");
			putchar('\n');
			system("echo output:");
			system("type out");
			putchar('\n');
			system("echo answer:");
			system("type ans");
			putchar('\n');
		#else
			system("cls");
		#endif
	}
	return 0;
}

Linux:

C++
#include <bits/stdc++.h>
using namespace std;
int main()
{
	register int k = 0;
	while (1)
	{
		k++;
		string s = "Testing_the_";
		if (k >= 1000000000) s += (k / 1000000000 % 10 + '0');
		if (k >= 100000000) s += (k / 100000000 % 10 + '0');
		if (k >= 10000000) s += (k / 10000000 % 10 + '0');
		if (k >= 1000000) s += (k / 1000000 % 10 + '0');
		if (k >= 100000) s += (k / 100000 % 10 + '0');
		if (k >= 10000) s += (k / 10000 % 10 + '0');
		if (k >= 1000) s += (k / 1000 % 10 + '0');
		if (k >= 100) s += (k / 100 % 10 + '0');
		if (k >= 10) s += (k / 10 % 10 + '0');
		s += (k % 10 + '0');
		s += "th_test_case";
		cout << s << endl;
		system("./data_maker > in");
		putchar('.');
		system("./correct < in > ans");
		putchar('.');
		system("./wrong < in > out");
		putchar('.');
		putchar('\n');
		if (system("diff out ans"))
		{
			putchar('W');
			putchar('r');
			putchar('o');
			putchar('n');
			putchar('g');
			break;
		}
		system("clear");
	}
	return 0;
}

最新研究:C++ 实现多线程

C++
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int main() {
	int n = 16;
	for (int i = 0; i < n; i++) {
		freopen((string("pai") + to_string(i) + ".cpp").c_str(), "w", stdout);
		cout << R"(#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int main()
{
	register int k = 0;
	while (1)
	{
		k++;
		string s = "title Testing the ";
		if (k >= 1000000000) s += (k / 1000000000 % 10 + '0');
		if (k >= 100000000) s += (k / 100000000 % 10 + '0');
		if (k >= 10000000) s += (k / 10000000 % 10 + '0');
		if (k >= 1000000) s += (k / 1000000 % 10 + '0');
		if (k >= 100000) s += (k / 100000 % 10 + '0');
		if (k >= 10000) s += (k / 10000 % 10 + '0');
		if (k >= 1000) s += (k / 1000 % 10 + '0');
		if (k >= 100) s += (k / 100 % 10 + '0');
		if (k >= 10) s += (k / 10 % 10 + '0');
		s += (k % 10 + '0');
		s += "th test case";
		system(s.c_str());
		system("data.exe > " __FILE__ "-pai.in");
		putchar('.');
		system("tj.exe < " __FILE__ "-pai.in > " __FILE__ "-pai.ans");
		putchar('.');
		system("me.exe < " __FILE__ "-pai.in > " __FILE__ "-pai.out");
		putchar('.');
		putchar('\n');
		if (system("fc " __FILE__ "-pai.out " __FILE__ "-pai.ans"))
		{
        	system("echo input:");
        	system("type " __FILE__ "-pai.in");
			putchar('W');
			putchar('r');
			putchar('o');
			putchar('n');
			putchar('g');
			freopen(__FILE__ "-success.txt", "w", stdout);
			system("echo input:");
			system("type " __FILE__ "-pai.in");
			putchar('\n');
			system("echo output:");
			system("type " __FILE__ "-pai.out");
			putchar('\n');
			system("echo answer:");
			system("type " __FILE__ "-pai.ans");
			putchar('\n');
			break;
		}
		#if 1
			system("echo input:");
			system("type " __FILE__ "-pai.in");
			putchar('\n');
			system("echo output:");
			system("type " __FILE__ "-pai.out");
			putchar('\n');
			system("echo answer:");
			system("type " __FILE__ "-pai.ans");
			putchar('\n');
		#else
			system("cls");
		#endif
	}
	return 0;
}
)";
		fclose(stdout);
		system((string("g++ pai") + to_string(i) + ".cpp -o pai" + to_string(i) + ".exe").c_str());
		system((string("start pai") + to_string(i) + ".exe").c_str());
	}
	return 0;
}