Add .clang-format and apply it

This commit is contained in:
2021-12-02 07:18:16 +00:00
parent e58dede1b6
commit cd5e2538df
103 changed files with 2714 additions and 2132 deletions

View File

@@ -13,11 +13,13 @@
constexpr unsigned mod = 20201227;
constexpr unsigned initial_subject = 7;
unsigned lcg(unsigned i, unsigned subject) {
unsigned lcg(unsigned i, unsigned subject)
{
return ((unsigned long)i * (unsigned long)subject) % mod;
}
unsigned find_loop_length(unsigned pk) {
unsigned find_loop_length(unsigned pk)
{
unsigned v = 1;
unsigned loop = 0;
while (v != pk) {
@@ -28,7 +30,8 @@ unsigned find_loop_length(unsigned pk) {
return loop;
}
unsigned apply(unsigned pk, unsigned loop_size) {
unsigned apply(unsigned pk, unsigned loop_size)
{
unsigned v = 1;
for (unsigned i = 0; i < loop_size; ++i) {
v = lcg(v, pk);
@@ -37,7 +40,8 @@ unsigned apply(unsigned pk, unsigned loop_size) {
return v;
}
int main(void) {
int main(void)
{
std::string line;
std::getline(std::cin, line);
unsigned pk1 = std::stoul(line);