专栏文章

卡时(系统时间)

个人记录参与者 1已保存评论 0

文章操作

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

当前评论
0 条
当前快照
1 份
快照标识符
@mip6nw8w
此快照首次捕获于
2025/12/03 07:02
3 个月前
此快照最后确认于
2025/12/03 07:02
3 个月前
查看原文
会有莫名其妙的误差,不清楚原因
考试不要用这个!!
C
#define timer std::chrono::_V2::system_clock::time_point
class Timers
{
  public:
	timer start = chrono::high_resolution_clock::now();
	void Start()
	{
		start = chrono::high_resolution_clock::now();
	}
	//1s数据:hzoi:1450;Luogu:978
	unsigned long long GetEnd()
	{
		timer stop = chrono::high_resolution_clock::now();
		unsigned long long spend = chrono::duration_cast<std::chrono::milliseconds>(stop - start).count();
		return spend;
	}
} Timer;

signed main()
{
	Timer.Start();
	int n;
	cin >> n;
	while (Timer.GetEnd() <= 980) {}
	cout << "Hello,World!";
	return 0;
}

评论

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

正在加载评论...