idiot-code-golf

Stupid solutions to simple problems.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
/*
Problem: Find the greatest common divisor of two numbers.

Solution: Euclidean algorithm except modulos are computed using trig functions!
*/

#include <bits/stdc++.h>
int gcd(int a,int b){while(a^b)std::swap(b,a=b*(M_PI/2-atan(cos(M_PI*a/b)/sin(M_PI*a/b)))/M_PI+1e-9);return a;}
int main(){std::cout<<gcd(126,84);}