Skip to content

Instantly share code, notes, and snippets.

Chih-Hsuan Kuo kuoe0

Block or report user

Report or block kuoe0

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View d151.cpp
bool DFS( int now, int cnt ) {
visit[ now ] = 1;
bool ret = 0;
if ( now == tgA )
ret = BFS( 1 );
if ( !cnt || ret ) {
visit[ now ] = 0;
return ret;
}
View sieve.cpp
#include <cstdio>
#include <cstdlib>
using namespace std;
#define MAX 1000000
bool isNotPrime[ MAX + 1 ];
void sieve() {
memset( isNotPrime, 0, sizeof( isNotPrime ) );
isNotPrime[ 0 ] = isNotPrime[ 1 ] = 1;
for ( int i = 2; i <= MAX; i += 2 )
isNotPrime[ i ] = 1;
View The 3n + 1 Problem.cpp
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
long long int MAX;
long long int count( int x ) {
if ( x == 1 )
return 0;
View toExcelColumnName.cpp
const char* toExcelColumnName( int n ) {
string ret = "";
while ( n ) {
int x = n % 26;
if ( x )
ret += 'A' + x - 1;
else
ret += 'Z', n -= 26;
n /= 26;
}
View 501 - Black Box.cpp
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
int main()
{
View 10039 - Railroads.cpp
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
#define MAXN 110
View 837 - Light and Transparencies.cpp
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
using namespace std;
struct POINT {
int x;
bool end;
double c;
View 2231 - Moo Volume.cpp
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
int pos[ 10010 ];
int main() {
int n;
View 1971 - Parallelogram Counting.cpp
#include <iostream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
struct POINT {
int x, y;
bool operator< ( const POINT r ) const {
return ( x < r.x ) || ( x == r.x && y < r.y );
View 1094 – Sorting It All Out.cpp
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
#define MAXN 50
vector< vector< int > > vertex, rev;
int in[ MAXN ], out[ MAXN ], visit[ MAXN ];
int n, e;
vector< int > topo;
You can’t perform that action at this time.