This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <unordered_map> | |
| using namespace std; | |
| int is_prime_f(int n) { | |
| int i; | |
| if(n < 2) | |
| return -1; | |
| else if(n == 2) | |
| return 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <sstream> | |
| #include <iomanip> | |
| using namespace std; | |
| vector<string> split(const string &s, char delim) { | |
| vector<string> elems; | |
| stringstream ss(s); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <stack> | |
| using namespace std; | |
| struct Point { | |
| double x; | |
| double y; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 15 | |
| 3.14979,8.51743 | |
| 2.39506,3.84915 | |
| 2.68432,5.39095 | |
| 5.61904,9.16332 | |
| 7.85653,4.75593 | |
| 2.84021,5.41511 | |
| 1.79500,8.59211 | |
| 7.55389,8.17604 | |
| 4.70665,4.66125 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| struct Vector { | |
| double x; | |
| double y; | |
| }; | |
| bool is_c_inner(double xa, double ya, double xb, double yb, double xc, double yc, double xd, double yd) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cmath> | |
| using namespace std; | |
| bool is_orth(double xa, double ya, double xb, double yb, double xc, double yc, double xd, double yd) { | |
| double inner_product = (xa-xb)*(xc-xd) + (ya-yb)*(yc-yd); | |
| return fabs(inner_product) < 1e-10; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <stack> | |
| #include <queue> | |
| #include <algorithm> | |
| #include <set> | |
| using namespace std; | |
| template <typename Tlist, typename Tfunc> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <complex> | |
| #include <vector> | |
| #include <stack> | |
| using namespace std; | |
| template<class T> bool operator<(const complex<T> &a, const complex<T> &b){ | |
| return a.real() == b.real() ? a.imag() < b.imag() : a.real() < b.real(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <complex> | |
| #include <vector> | |
| #include <stack> | |
| using namespace std; | |
| template<class T> bool operator<(const complex<T> &a, const complex<T> &b){ | |
| return a.real() == b.real() ? a.imag() < b.imag() : a.real() < b.real(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <complex> | |
| #include <vector> | |
| #include <stack> | |
| using namespace std; | |
| template<class T> bool operator<(const complex<T> &a, const complex<T> &b){ | |
| return a.real() == b.real() ? a.imag() < b.imag() : a.real() < b.real(); | |
| } |