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 April 17, 2015 09:12
java biginteger compare, equals
import java.util.*;
import java.math.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
BigInteger a = sc.nextBigInteger();
BigInteger b = sc.nextBigInteger();
int c = a.compareTo(b);
if (c < 0) {
@Baekjoon
Baekjoon / Main.java
Created April 17, 2015 09:07
java biginteger fibonacci
import java.util.*;
import java.math.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
BigInteger[] f = new BigInteger[100];
f[0] = BigInteger.ZERO;
f[1] = BigInteger.ONE;
for (int i=2; i<f.length; i++) {
@Baekjoon
Baekjoon / Main.java
Created April 17, 2015 08:37
java bigintger
import java.util.*;
import java.math.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
BigInteger a = sc.nextBigInteger();
BigInteger b = sc.nextBigInteger();
BigInteger sum = a.add(b);
System.out.println(sum.toString());
@Baekjoon
Baekjoon / Main.java
Created April 17, 2015 08:36
java-biginteger
import java.util.*;
import java.math.*;
public class Main {
public static void main(String args[]) {
BigInteger a = new BigInteger("9223372036854775807");
BigInteger b = new BigInteger("9223372036854775808");
BigInteger sum = a.add(b);
System.out.println(sum.toString());
}
@Baekjoon
Baekjoon / Main.java
Created April 17, 2015 07:32
java scanner
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = sc.nextLine();
System.out.println(n + "\n" + s);
}
}
@Baekjoon
Baekjoon / Main.java
Created April 17, 2015 07:13
Java-Scanner
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(a+b);
}
}
@Baekjoon
Baekjoon / stderr.cc
Created April 16, 2015 17:40
stderr
fprintf(stderr,"This is stderr. sum = %d, budget = %d\n",sum, budget);
cerr << "This is stderr. sum = " << sum << ", budget = " << budget << endl;
@Baekjoon
Baekjoon / CucumberMarket.cc
Created April 16, 2015 14:58
CucumberMarket
#include <vector>
#include <string>
using namespace std;
class CucumberMarket {
public:
string check(vector <int> price, int budget, int k) {
}
};
#include <cstdio>
int main() {
int a[9];
int n=9;
for (int i=0; i<n; i++) {
scanf("%d",&a[i]);
}
int l[9];
for (l[0]=0; l[0]<n; l[0]++) {
for (l[1]=0; l[1]<n; l[1]++) {
#include <cstdio>
int main() {
int a[9];
int n=9;
for (int i=0; i<n; i++) {
scanf("%d",&a[i]);
}
for (int l1=0; l1<n; l1++) {
for (int l2=0; l2<n; l2++) {
if (l1 == l2) continue;