Skip to content

Instantly share code, notes, and snippets.

@firejox
firejox / A4.java
Last active August 29, 2015 13:57
A4 Work
package ce1002.a4.s101201046;
import java.util.Scanner;
public class A4 {
public static void main(String[] args) {
Car[] cars;
int i;
int num;
@firejox
firejox / A5.java
Last active August 29, 2015 13:57
A5
package ce1002.a5.s101201046;
public class A5 {
public static void main(String[] args) {
Hero[] heros;
int i;
heros = new Hero[3];
heros[0] = new Wizard(); //set Wizard
package ce1002.a6.s101201046;
public class A6 {
public static void main(String[] args) {
Hero[] heros;
MyPanel[] panels = new MyPanel[3];
MyFrame frame = new MyFrame();
heros = new Hero[3];
@firejox
firejox / A10.java
Last active August 29, 2015 14:01
ce1002.a10.s101201046
package ce1002.a10.s101201046;
public class A10 {
public static void main(String[] args) {
try {
MyFrame frame = new MyFrame(); //create a frame
} catch(Exception ex) {
ex.printStackTrace();
}
@firejox
firejox / A12.java
Created May 23, 2014 17:38
ce1002.a12.s101201046
package ce1002.a12.s101201046;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
public class A12 extends KeyAdapter {
static JFrame jf;
static { //initial JFrame
@firejox
firejox / b326.c
Created October 26, 2014 15:11
b326 (努力理解紅黑樹中)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXN 32780
typedef struct _Node *Node;
#define BLACK 1
#define RED 0
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
typedef struct __yfunc{
double p[9];
double q[9];
size_t len;
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <arpa/inet.h>
#include <stdlib.h>
namespace {
struct cat {
int ret;
exp PROC,
x:REAL4
movzx eax, 256
push eax
fld x
fild dword ptr[esp]
fdiv
fld1
fadd
@firejox
firejox / result
Last active November 23, 2016 02:09
# AMD Athlon(tm) II X2 270 Processor
# Arch Linux x86_64
# gcc (GCC) 6.2.1 20160830
# Crystal 0.19.4 (2016-10-07)
======== random2 2097152 =============
with intro sort 6.82 (± 7.91%) fastest
with another intro sort 6.22 (± 7.18%) 1.10× slower
with std::sort in cpp 6.74 (± 7.34%) 1.01× slower
with qsort in c 3.59 (± 5.62%) 1.90× slower
======== seq 2097152 =============