Skip to content

Instantly share code, notes, and snippets.

@Macesuted
Last active March 11, 2023 06:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
"「SFCOI-1」Sadness Fan Club Round 1" reward code
/**
* @file reward.cpp
* @author Macesuted (i@macesuted.moe)
* @date 2023-03-11
*
* @copyright Copyright (c) 2023
*
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
mt19937 rnd(123456);
int n;
cin >> n; // 符合要求的总人数
set<int> S;
for (int i = 0; i < 3; i++) {
int p = rnd() % n;
while (S.count(p)) p = (p + 1) % n;
S.insert(p);
cout << p + 1 << ' ';
}
cout << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment