รันคำสั่งใน history
console |
[cs] |
หาไฟล์ที่มีขนาดมากกว่า 10 M ในไดเร็กทอรี่ปัจจุบัน (./)
wk@wk-laptop:~$ find ./ -type f -size +10M ./.cache/chromium/Cache/data_3 ./.cache/chromium/Cache/data_1 ./.cache/chromium/Cache/data_2 ./.mozilla/firefox/7ax1m6pm.default/urlclassifier3.sqlite ./.config/chromium/Default/History Index 2009-12 ./.config/chromium/Default/History Index 2009-12-journal ./.config/chromium/Default/Thumbnails ./.config/chromium/Safe Browsing Bloom
ได้หนังมาหนึ่งเรื่องกะจะนอนดูซะหน่อย แต่ดันเปิดมาไม่มีภาพมาแต่เสียง มันบอกว่ามันหา XVID MPEG-4 decoder ไม่เจอ นี้แหละเขาเรียกว่า Koala มีกรรม สุดท้ายก็ต้องลงเพิ่ม วิธีการคือ กด Alt + F2 แล้ว Copy ขอความนี้ไปวาง "apt:ubuntu-restricted-extras?section=universe?section=multiverse" กด Enter หนึ่งครั้ง แล้วมันจะบอกว่านั่งรออีก 15 ชั่วโมงนะ
ลง Ubuntu 9.10 เพราะว่า 9.04 ที่ใช้ก่อนหน้านี้เละเทะไปแล้ว ลงโปรแกรมเยอะเกินเหตุ มั่วมากๆ อืดสุดๆ ไปลงนรกได้เลย 9.04
นั่งเขียนโปรแกรมแก้โจทย์ข้อ 12 ได้ออกมาแล้วน่าจะทำงานถูก เนื่องจากใช้วิธี Brute Force ก็เลยอืม... ยังไม่ได้ผลลัพท์ คงต้องแก้ให้เข้าทีเข้าทางก่อน แล้วจะมาโพสอัปเดตอีกที
The following iterative sequence is defined for the set of positive integers:n = n/2 (n is even)n = 3n + 1 (n is odd)Using the rule above and starting with 13, we generate the following sequence:13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.Which starting number, under one million, produces the longest chain?NOTE: Once the chain starts the terms are allowed to go above one million
-module(chain).
-export([main/1]).
main([I]) ->
V = list_to_integer(atom_to_list(I)),
A = chain(start, V, 0 , V),
io:format("Max ~p = ~p ~n", A),
init:stop().
chain(1, 1) ->
[1];
chain(0, N) ->
[N] ++ chain( (N div 2) rem 2 , N div 2);
chain(1,N) ->
[N] ++ chain( (3*N + 1) rem 2 , 3*N + 1).
chain(start, Start, Chain, 1) ->
[Start, Chain];
chain(start, Start,Chain , N) ->
M = length(chain(N rem 2, N)),
A = M > Chain,
io:format("~p = ~p ~n", [N,M]),
case A of
true -> chain(start, N, M ,N-1 );
false -> chain(start, Start, Chain ,N-1)
end.wk# erlc chain.erl wk# time erl -noshell -s chain main 999999 999999 = 259 999998 = 259 999997 = 114 ... 3 = 8 2 = 2 Max 837799 = 525
-module(zeez2).
-export([main/1]).
main([A]) ->
L = list_to_integer(atom_to_list(A)),
zeez( true ,L, L).
zeez(true, 0, N) ->
io:format("~p~n", [zeez(z, N)]),
init:stop();
zeez(false, M, N) ->
io:format("~p~n", [zeez(space, M)]),
zeez(M-1 rem N =:= 0, M-1, N );
zeez(true, M, N) ->
io:format("~p~n", [zeez(z, M)]),
zeez(M-1 rem N =:= 0, M-1 , N ).
zeez(space, 0) ->
"Z";
zeez(space, N) ->
"-" ++ zeez(space, N-1);
zeez(z,0) ->
"Z";
zeez(z, N) ->
"Z" ++ zeez(z, N-1).wk# erlc zeez2.erl wk# erl -noshell -s zeez2 main 10
"ZZZZZZZZZZZ" "---------Z" "--------Z" "-------Z" "------Z" "-----Z" "----Z" "---Z" "--Z" "-Z" "ZZZZZZZZZZZ"