Skip to content

Instantly share code, notes, and snippets.

View Vicfred's full-sized avatar
:octocat:
I like mathemagic and computering

Vicfred Vicfred

:octocat:
I like mathemagic and computering
View GitHub Profile
@Vicfred
Vicfred / airplane.cpp
Last active August 29, 2015 13:55
Rent your Airplane and make Money
//http://coj.uci.cu/24h/problem.xhtml?abb=1005
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
using namespace std;
struct plane {
int st, end, prize;
@Vicfred
Vicfred / cd.cpp
Last active August 29, 2015 13:55
624 - CD
//http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=565
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
@Vicfred
Vicfred / umbrellas.cpp
Last active August 29, 2015 13:56
umbrellas for cows
//http://coj.uci.cu/24h/problem.xhtml?abb=1962
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
int memo[50005];
int cache[50005];
int cows[50005];
@Vicfred
Vicfred / snapper.cpp
Last active August 29, 2015 13:56
Snapper Chain
//https://code.google.com/codejam/contest/433101/dashboard#s=p0
#include <cstdio>
using namespace std;
int main() {
int t, n, k;
scanf("%d", &t);
@Vicfred
Vicfred / domino.cpp
Last active August 29, 2015 13:56
2530 Tiling a Grid With Dominoes
//http://www.spoj.com/problems/GNY07H/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#define MAXN 100000
using namespace std;
@Vicfred
Vicfred / ritsuko.c
Last active August 29, 2015 13:56
423 Assignments
//http://www.spoj.com/problems/ASSIGN/
#include <stdio.h>
#include <stdlib.h>
#define MAXN (1 << 22)
int n;
int asuka[22];
long long int memo[MAXN];
@Vicfred
Vicfred / gold.cpp
Last active August 29, 2015 13:56
Collecting Gold
//http://lightoj.com/volume_showproblem.php?problem=1057
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
int n, m;
int gold;
@Vicfred
Vicfred / homer.cpp
Created February 10, 2014 05:36
10465 - Homer Simpson
//http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1406
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
int n, m, t;
while(scanf("%d %d %d", &m, &n, &t) != EOF) {
int dp[10005];
@Vicfred
Vicfred / cowsgrrrrrr.cpp
Last active August 29, 2015 13:56
297 Aggressive cows
//http://www.spoj.com/problems/AGGRCOW/
#include <cstdio>
#include <algorithm>
using namespace std;
bool feasible(int *a, int n, int c, int dist) {
int last = 0; int cows = 1;
for(int i = 1; i < n; i++) {
if(a[i]-a[last] >= dist) {
@Vicfred
Vicfred / flip.cpp
Created February 24, 2014 09:52
2534 - Arrow Flips
//http://coj.uci.cu/24h/problem.xhtml?abb=2534
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;
int main() {