Browse Source

Consistent dir names

main
André Palmborg 5 years ago
parent
commit
ae6396c377
  1. 2
      README.md
  2. 22
      pseudoprime-numbers/main.cpp
  3. 0
      u100-the-3n+1-problem/p100.c
  4. 0
      u10071-back-to-high-school-physics/Makefile
  5. 0
      u10071-back-to-high-school-physics/main.cpp
  6. 0
      u10168-summation-of-four-primes/Makefile
  7. 0
      u10168-summation-of-four-primes/main.cpp
  8. 0
      u10168-summation-of-four-primes/tests
  9. 0
      u10684-the-jackpot/Makefile
  10. 0
      u10684-the-jackpot/main.cpp
  11. 0
      u10684-the-jackpot/t1
  12. 0
      u10684-the-jackpot/t2
  13. 0
      u10684-the-jackpot/t3
  14. 0
      u10684-the-jackpot/t4
  15. 0
      u10812-beat-the-spread/Makefile
  16. 0
      u10812-beat-the-spread/main.cpp
  17. 0
      u11264-coin-collector/Makefile
  18. 0
      u11264-coin-collector/main.cpp
  19. 0
      u11264-coin-collector/test
  20. 0
      u11495-bubbles-and-buckets/Makefile
  21. 0
      u11495-bubbles-and-buckets/main.cpp
  22. 0
      u11495-bubbles-and-buckets/t1
  23. 0
      u11495-bubbles-and-buckets/tests
  24. 0
      u116-unidirectional-tsp/p116.c
  25. 0
      u1262-password/Makefile
  26. 0
      u1262-password/main.cpp
  27. 0
      u1262-password/t1
  28. 0
      u1262-password/t2
  29. 0
      u1262-password/t21
  30. 0
      u1262-password/t3
  31. 0
      u1262-password/t4
  32. 0
      u1262-password/t5
  33. 0
      u231-testing-the-catcher/231.py
  34. 0
      u441-lotto/solve.py
  35. 0
      u441-lotto/t1
  36. 0
      u441-lotto/t2
  37. 0
      u441-lotto/tests
  38. 0
      u482-permuation-arrays/Makefile
  39. 0
      u482-permuation-arrays/main.cpp
  40. 0
      u482-permuation-arrays/out
  41. 0
      u482-permuation-arrays/t1
  42. 0
      u482-permuation-arrays/t2
  43. 0
      u482-permuation-arrays/tst
  44. 0
      u642-word-amalgamation/642.py
  45. 0
      u927-integer-sequences-from-addition-of-terms/Makefile
  46. 0
      u927-integer-sequences-from-addition-of-terms/main.cpp
  47. 0
      u927-integer-sequences-from-addition-of-terms/t0
  48. 0
      u927-integer-sequences-from-addition-of-terms/test

2
README.md

@ -5,5 +5,5 @@ Solutions to problems from various competitive programming sites.
Beware of old, questionable-looking, code.
* More general solutions can be found under the directory 'algorithms-and-datastructures'
* Problems found at 'Open Kattis' have been put in directory named after the problem title.
* Problems found at 'Open Kattis' have been put in directories named after the problem title.
* Problems I could only find through 'Online Judge' (UVa) are prepended with a 'u' and the problem number at UVa.

22
pseudoprime-numbers/main.cpp

@ -1,19 +1,23 @@
#include <stdio.h>
#include <chrono>
#include <iostream>
typedef long long unsigned llu;
bool isPrime(int n)
{
if ( n == 2 || n == 3 )
if ( n == 2 || n == 3 ) {
return true;
else if ( n%2 == 0 || n%3 == 0)
} else if ( n%2 == 0 || n%3 == 0 ) {
return false;
}
long unsigned i=5, o=0, m=3;
while ( n != 1 && 0 < n && i < n/m )
{
if ( n%i == 0 )
if( n%i == 0 ) {
return false;
}
m = i;
if( i%6 == 5 ) {
@ -28,7 +32,7 @@ bool isPrime(int n)
llu repMod(const llu a, const llu p)
{
if (p == 0) return 1;
if( p == 0 ) { return 1; }
llu e = p;
llu rem = 1;
@ -42,7 +46,7 @@ llu repMod(const llu a, const llu p)
rem *= c;
rem %= p;
if (--e == 0) return rem;
if( --e == 0 ) { return rem; }
}
c *= c;
@ -77,6 +81,8 @@ void isBAPP(int a, int p)
int main()
{
int p, a;
auto t_start = std::chrono::high_resolution_clock::now();
while(1)
{
scanf("%d %d\n", &p, &a);
@ -85,4 +91,10 @@ int main()
// Calc.
isBAPP(a, p);
}
auto t_stop = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(t_stop - t_start);
std::cout << "Duration: " << duration.count() << std::endl;
}

0
u100-The-3n+1-Problem/p100.c → u100-the-3n+1-problem/p100.c

0
u10071-Back-to-High-School-Physics/Makefile → u10071-back-to-high-school-physics/Makefile

0
u10071-Back-to-High-School-Physics/main.cpp → u10071-back-to-high-school-physics/main.cpp

0
u10168-Summation-of-Four-Primes/Makefile → u10168-summation-of-four-primes/Makefile

0
u10168-Summation-of-Four-Primes/main.cpp → u10168-summation-of-four-primes/main.cpp

0
u10168-Summation-of-Four-Primes/tests → u10168-summation-of-four-primes/tests

0
u10684-The-Jackpot/Makefile → u10684-the-jackpot/Makefile

0
u10684-The-Jackpot/main.cpp → u10684-the-jackpot/main.cpp

0
u10684-The-Jackpot/t1 → u10684-the-jackpot/t1

0
u10684-The-Jackpot/t2 → u10684-the-jackpot/t2

0
u10684-The-Jackpot/t3 → u10684-the-jackpot/t3

0
u10684-The-Jackpot/t4 → u10684-the-jackpot/t4

0
u10812-Beat-the-Spread/Makefile → u10812-beat-the-spread/Makefile

0
u10812-Beat-the-Spread/main.cpp → u10812-beat-the-spread/main.cpp

0
u11264-Coin-Collector/Makefile → u11264-coin-collector/Makefile

0
u11264-Coin-Collector/main.cpp → u11264-coin-collector/main.cpp

0
u11264-Coin-Collector/test → u11264-coin-collector/test

0
u11495-Bubbles-and-Buckets/Makefile → u11495-bubbles-and-buckets/Makefile

0
u11495-Bubbles-and-Buckets/main.cpp → u11495-bubbles-and-buckets/main.cpp

0
u11495-Bubbles-and-Buckets/t1 → u11495-bubbles-and-buckets/t1

0
u11495-Bubbles-and-Buckets/tests → u11495-bubbles-and-buckets/tests

0
u116-Unidirectional-TSP/p116.c → u116-unidirectional-tsp/p116.c

0
u1262-Password/Makefile → u1262-password/Makefile

0
u1262-Password/main.cpp → u1262-password/main.cpp

0
u1262-Password/t1 → u1262-password/t1

0
u1262-Password/t2 → u1262-password/t2

0
u1262-Password/t21 → u1262-password/t21

0
u1262-Password/t3 → u1262-password/t3

0
u1262-Password/t4 → u1262-password/t4

0
u1262-Password/t5 → u1262-password/t5

0
u231-Testing-the-CATCHER/231.py → u231-testing-the-catcher/231.py

0
u441-Lotto/solve.py → u441-lotto/solve.py

0
u441-Lotto/t1 → u441-lotto/t1

0
u441-Lotto/t2 → u441-lotto/t2

0
u441-Lotto/tests → u441-lotto/tests

0
u482-Permuation-Arrays/Makefile → u482-permuation-arrays/Makefile

0
u482-Permuation-Arrays/main.cpp → u482-permuation-arrays/main.cpp

0
u482-Permuation-Arrays/out → u482-permuation-arrays/out

0
u482-Permuation-Arrays/t1 → u482-permuation-arrays/t1

0
u482-Permuation-Arrays/t2 → u482-permuation-arrays/t2

0
u482-Permuation-Arrays/tst → u482-permuation-arrays/tst

0
u642-Word-Amalgamation/642.py → u642-word-amalgamation/642.py

0
u927-Integer-Sequences-from-Addition-of-Terms/Makefile → u927-integer-sequences-from-addition-of-terms/Makefile

0
u927-Integer-Sequences-from-Addition-of-Terms/main.cpp → u927-integer-sequences-from-addition-of-terms/main.cpp

0
u927-Integer-Sequences-from-Addition-of-Terms/t0 → u927-integer-sequences-from-addition-of-terms/t0

0
u927-Integer-Sequences-from-Addition-of-Terms/test → u927-integer-sequences-from-addition-of-terms/test

Loading…
Cancel
Save