Skip to content

Instantly share code, notes, and snippets.

View Baekjoon's full-sized avatar

Baekjoon Choi Baekjoon

View GitHub Profile
@Baekjoon
Baekjoon / Main.java
Created November 17, 2015 16:00
1000 Java
import java.util.*;
public class Main {
public static void main(String[] args) {
new Main().solve();
}
void solve(){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
@Baekjoon
Baekjoon / Main.java
Last active November 17, 2015 16:00
1000 Java
import java.util.*;
class P1000 {
public void solve(){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(a+b);
}
}
@Baekjoon
Baekjoon / 5052.cc
Created October 30, 2015 19:32
5052
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct Node {
bool valid;
Node *children[10];
Node() {
valid = false;
for (int i=0; i<10; i++) {
@Baekjoon
Baekjoon / 5052.cc
Created October 30, 2015 19:23
5052
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct Node {
bool valid;
int children[10];
Node() {
valid = false;
for (int i=0; i<10; i++) {
@Baekjoon
Baekjoon / brute.cc
Created October 27, 2015 17:35
brute
#include <iostream>
#include <string>
using namespace std;
int match(string s, string p) {
int n = s.size();
int m = p.size();
for (int i=0; i<=n-m; i++) {
bool ok = true;
for (int j=0; j<m; j++) {
if (s[i+j] != p[j]) {
@Baekjoon
Baekjoon / 11279.cc
Created October 24, 2015 23:29
11279
#include <cstdio>
#include <algorithm>
using namespace std;
int heap[100001];
int hn;
int pop() {
int ans = heap[1];
heap[1] = heap[hn];
heap[hn--] = 0;
for (int i=1; i*2 <= hn;) {
@Baekjoon
Baekjoon / Main.java
Created October 24, 2015 19:38
1991
import java.util.*;
public class Main {
public static void preorder(int[][] a, int x) {
if (x == -1) return;
System.out.print((char)(x+'A'));
preorder(a,a[x][0]);
preorder(a,a[x][1]);
}
public static void inorder(int[][] a, int x) {
if (x == -1) return;
@Baekjoon
Baekjoon / 1031.cc
Created October 24, 2015 01:15
1031
#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <queue>
using namespace std;
struct MCMF {
@Baekjoon
Baekjoon / 6267.cc
Created October 23, 2015 21:05
6267
#include <iostream>
#include <numeric>
#include <string>
#include <queue>
#include <vector>
using namespace std;
struct MCMF {
struct Edge {
int to;
int capacity;
@Baekjoon
Baekjoon / 3938.cc
Created October 23, 2015 20:35
3938
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
struct MCMF {
struct Edge {
int to;
int capacity;
int cost;
Edge *rev;