- 月赛
龙年新春基础赛 (Div.4) 获奖名单
- 2024-2-5 17:01:03 @
一等奖
奖品: 64GB USB3.2 U盘x1
to be announced.
二等奖
奖品: 10~20元随机红包x1
to be announced.
三等奖
奖品: 5~10元随机红包x1
to be announced.
随机金额的红包金额将由以下代码生成
#include <bits/stdc++.h>
using namespace std;
/*
该代码使用Intel® Digital Random Number Generator (DRNG) 技术确保真随机。
https://www.intel.com/content/www/us/en/developer/articles/guide/intel-digital-random-number-generator-drng-software-implementation-guide.html
*/
int rdseed64_step (uint64_t *seed)
{
// 从Intel DRNG指令集获取64位RDSEED
unsigned char ok;
asm volatile ("rdseed %0; setc %1"
: "=r" (*seed), "=qm" (ok));
return (int) ok;
}
int main()
{
uint64_t rand = 0;
int result = 0;
if (rdseed64_step (&rand))
{
result = (int) (rand % 11 + 10);
cout << "The random number(10-20) is " << result << endl;
cout << "The random number(5-10) is " << result/2 << endl;
}
return 0;
}