专栏文章

测代码时空

算法·理论参与者 1已保存评论 0

文章操作

快速查看文章及其快照的属性,并进行相关操作。

当前评论
0 条
当前快照
1 份
快照标识符
@ming7ycs
此快照首次捕获于
2025/12/02 01:54
3 个月前
此快照最后确认于
2025/12/02 01:54
3 个月前
查看原文
CPP
#include <bits/stdc++.h>
#define int long long
using namespace std;

bool st; // 
int a, b;
int arr[114514];
vector<int> vec;
set<int> s;
priority_queue<int> q;
map<int,int> mapp;
pair<int,int> pr[114514];
bool ed; // 用两个 bool 类型变量框住所有定义的东西(只能测定义变量的空间) 

signed main() {
	clock_t s = clock();
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> a >> b;
	cout << a + b << '\n';
	// 在所有答案输出之后(干脆就 return 0 之前再测一次时间) 
	clock_t t = clock();
	cout << fixed << setprecision(3) << 1.0 * (t - s) / CLOCKS_PER_SEC << "秒" << '\n'; // 记得一定是除以 CLOCKS_PER_SEC 
	// 测时间 
	cout << 1.0 * (&ed - &st) / 1024 / 1024 << "MB" <<'\n';
	// 测空间 
	return 0;
} // 这个方法测时间一定是用文件读入才能测准 
// 111

评论

0 条评论,欢迎与作者交流。

正在加载评论...