Skip to content

Instantly share code, notes, and snippets.

View morris821028's full-sized avatar
💭
I may be slow to respond.

Morris Yang, Shiang-Yun Yang morris821028

💭
I may be slow to respond.
View GitHub Profile
@morris821028
morris821028 / gist:700cec3da5224318bbbb
Last active August 29, 2015 14:27
Zerojudge d539 code
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <vector>
using namespace std;
class OfflineRMQ {
public:
static const int MAXN = 500005;
static const int MAXQ = 500005;
struct Node {
@morris821028
morris821028 / QTREE6.cpp
Last active August 29, 2015 14:27 — forked from anonymous/QTREE6.cpp
QTREE6-lct
#include <cstdio>
const int N = 100009;
int ec,son[N],lnk[N * 2],nxt[N * 2],col[N],fa[N];
struct lct
{
int l[N],r[N],p[N],sz[N],w[N];
void init(int n)
{
++n;
for (int i = 0; i <= n; ++i) l[i] = r[i] = p[i] = sz[i] = 0;
@morris821028
morris821028 / gist:4b6738d6ba83e8971df7
Last active August 29, 2015 14:25
b452: 傻傻地幫人數錢錢.cpp
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <vector>
#include <algorithm>
using namespace std;
class IMAGE {
@morris821028
morris821028 / paper.md
Created April 27, 2015 03:40
虛擬實境 論文研讀

title: 虛擬實境 論文研讀 date: 2015-04-27 09:55:00 tags: [] categories: [學校課程, 虛擬實境]

期末上繳報告啊,不知道要寫多少才對得起自己。理解正確性不敢保證,相當可怕。

單詞概要

#include <stdio.h>
#include <string.h>
// in AES, GF(2^8), m(x) = x^8 + x^4 + x^3 + x + 1
class GaloisField {
public:
unsigned char v[32];
int n;
GaloisField() {
n = 8;
@morris821028
morris821028 / gist:702e07fa3910d402de4f
Created April 22, 2015 03:37
Information Security : exam 1
  1. Follow

    1. What is a monoalphabetic cipher ?
    2. How large is the key space of the monoalphabetic cipher applied to English (just consider lower case letters) ?
    3. What is the main security weakness of a monoalphabetic cipher ?
    4. Please provide at least 4 approaches to prevent the above weakness.
  2. Block ciphers process messages in blocks like an extremely large substitution, but this is very difficult to implement for a very big block size. What is Shannon's idea to realize a block cipher with big block size ?

  3. The S-box of DES round operation is not invertable, but why DES can decrypt ?

@morris821028
morris821028 / gist:51d778ee8e3589e70e3e
Created April 20, 2015 13:57
Clean Github Commit

將原本的檔案複製到新的 new_dir,或者直接刪除 .git。

cd new_dir
git init

使用 forced updated

@morris821028
morris821028 / gist:0f8928ccf42b470c6a14
Created April 2, 2015 00:04
BigData BlockRecordReader Notes

格式

解析每一個網站有很多方法,但是由於每個網站的 html 雜燴在同一個 file 中,導致解析問題的存在。

hadoop 內建 readline() 支持跨檔讀取,同時也支持跨數個檔案讀取。 這一點可以從 hadoop MRunit 中測試得到。

回過頭來探討

案例一

@morris821028
morris821028 / clickerHeroSave.txt
Created March 15, 2015 15:16
Game clickerHero
e5yhJOj8cDmJV0h4d1G9lfvDbklwRtpabTWVVfzhdJGVF4t4c2CZIv6FMDT9QLyeN1j6MUwhOcDycQw3M6zNMBzBNEiQwui8duGt9d0JY9WrxyHHbw2lxmkLIgjyoty4Lsjecg0JNljbINwIMYDlIyynM5zCEawsMXDuk93HZvSTsKynMXi6wSi4dcXhBnn0cSm3Fzk4ZCXLM5iCO1nDsLiDMoiCIv6ndBHDJP1ZZ8S4wniOMCynIP6Cd4HTJU1QZjSLwDiFNQCpIV6AdJHNJ11bZcSjwBi1NNS1IG6edRH4JY1pZySBwoiSN9iNIv64d2HpJE1qZgSSwuiENyyxIg6odcHlJW1kZNSVwSiVOWC7IZ6JdaHjJL1cZGSawUi0OiSzIX6HdtHkJg19ZBSSw0iKMNTEAFi6OhnKRmyvdLWFUZs7IQj2ESxZI5jdpO0ZcUn2VmlyLUCBIwxqMFisIS6Od1HWJg10Z4SYwUirMbTwMwi9OXnQR5yKdRWTUgsvIQjjEV04IUjPpC0wcbn3VUlfLoCFIoxcNXSEIN6qdAHmJe1aZTSpwoiaMXTjYwirOBnERTyQdIWCUnsbIfjPEJ32IrjfpD0mcznHVDlDLhCRIxxPO1C4Il6Pd8HqJK1pZHSEwIiLMuTIkPiGOUnaR3y7dXWDUPsRIsjmIGw6Iqj1ph0gcHnhVClyLRCaIdygMnSaIZ6od5HZJ71oZ9ScwvidMvjbIxidO9nlRsy1dLWIUCsTI6joIlzYIAjYpa07cknnVXl5LiCwISyJNCCUIG6PdIHpJk1lZJSNwyifMmjyUkiQONnGRTybdYWlU5sYIGjFIj21INjjpz0UcOnTVIlpLAC1Iey1NVyPIo65doH1Jz11ZASIwoi6MUjVgRi3OTnNRvyUdiWTUPstIVjyI65pIQj9pZ0lcjniVClSLQCZIczeMBCaIy6vdqHlJ51UZdSlwAiNMrz2EAiLOmn6ROyNdGWKUysoINjDMZypIPjqpP0XcFnIVAlpLqCpIQzW
// You can edit this code!
// Click here and start typing.
// http://hdechallenge.appspot.com/challenge?email=b7615199%40hotmail.com&key=9160760b19bc9fe7dd746d2d53e23e86640f1d71
package main
import "fmt"
func sum(n int) int {
if n == 0 {
return 0