基礎量子演算法與應用 | 2026 高中量子計算暑期營筆記
A comprehensive study note from the 2026 High School Quantum Computing Summer Camp. Covering quantum mechanics postulates, Schrodinger equation derivation, and step-by-step analysis of key quantum algorithms (Deutsch, Grover) and communication protocols with circuit maze visualizations.
CSES Counting Bits 題解
題目 題目見網址:https://cses.fi/problemset/task/1146/ 我懶得複製過來了XD 簡單來說就是輸入 nnn,要問 111 到 nnn 中的所有正整數寫成二進位之後總共有幾個 111。 其實這是排列組合那邊的經典問題,只是數學課我們是直接在十進位算。 解法 憶起高中數學 回想一下高中排列組合的某個問題: 111~999999999 中共有多少個 999? 有兩種解法,一種是分別算個位數、十位數、百位數有多少 999,但有另一種比較快的看法(機率觀點): 我們要找的相當於 000,001,002,003,…,999000, 001, 002, 003, \dots, 999 000,001,002,003,…,999 中 111 的個數,裡面總共有 3×1000=30003\times1000=30003×1000=3000 個「000~999 的數字」,而 000~999 出現機率相同,所以所求即為 3000×110=3003000\times\frac{1}{10}=300 3000×101=300 細說本題 接著就只是十進位轉成二進位而已...
pwnable.tw - orw Writeup
Challenge description Read the flag from /home/orw/flag. Only open read write syscall are allowed to use. nc chall.pwnable.tw 10001 I don’t know why Microsoft Defender suggests it’s a virus, lol. Let’s do it on Kali :) Inspection file ┌──(kali㉿kali)-[~/Desktop] └─$ file orw orw: ELF 32-bit LSB executable, Intel i386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=e60ecccd9d01c8217387e8b77e9261a1f36b5030, not stripped It i...
pwnable.kr - fd Writeup
Challenge Description Mommy! what is a file descriptor in Linux? * try to play the wargame your self but if you are ABSOLUTE beginner, follow this tutorial link: https://youtu.be/971eZhMHQQw ssh fd@pwnable.kr -p2222 (pw:guest) Solution Log in to the shell and list the current directory. fd@ubuntu:~$ ls fd fd.c flag readme Try to cat the flag, we get “Permission denied”. So, we inspect the source code of fd.c fd.c#include <stdio.h> #include <stdlib.h> #include <string.h> char buf[3...
數字狼人殺:一道結合「實話謊話判斷」與「和與積問題」的精彩自編邏輯題
一道自編的邏輯推理題目,結合了經典的「實話謊話判斷」和「和與積問題」,題目的分析複雜而有趣。
2026 APMOC 心得
為什麼時隔那麼久突然想回來寫APMOC的心得呢?其實我每次參與活動都會想記錄下來,但常常都很懶然後日記就根本沒寫或寫一半,所以就藉著最近剛建Blog想發點東西時順便把它紀錄下來~ 初選第一階段 這件事要從我高三報名數奧初選第一階段開始說起,這是我第二次報名數奧初選,考場在建中。在那之前,我已多次前往建中,幾乎每次都是去考試:考科學班、數奧初選、物奧初選、物奧研討、物奧複選,所以對交通應已不陌生。中正紀念堂二號出口出來轉個彎,從南門市場開始一路直走,途經許多店家,再行過一天橋,不用多久便抵達。我國中(有印象以來)第一次抵達建中便感受到一股不凡的氣場,那是一種和建中制服卡其色相似的典雅,令人為之一顫。 下了捷運,循著熟悉的路卻見整修中的二號出口——此路不通,而我是唯一一個發楞的人。時間在手腕上的錶中跳動,我能繼續等待嗎?突然,一個熟悉的身影呼嘯而過,我追趕而上。他是我們班的數學大佬——鼎鼎大名的呂博士。於是我跟隨他自一旁的出口脫困(即使那條其實是遠路),在我完全陌生的街道奔跑著。 倒數計時,奔跑化為衝刺,最終如兩支標槍射入數學的殿堂。鐘響,時間剛好。 在喘氣和汗流之下寫數學,是名副其...
CSES - Counting Divisors 題解
我把這題想太複雜了…… 弄了個爛解 題目 Time limit: 1.00 s Memory limit: 512 MB Given nnn integers, your task is to report for each integer the number of its divisors. For example, if x=18x=18x=18, the correct answer is 666 because its divisors are 1,2,3,6,9,181,2,3,6,9,181,2,3,6,9,18. Input Output The first input line has an integer nnn: the number of integers. After this, there are nnn lines, each containing an integer xxx. For each integer, print the number of its divisors. Constraints 1≤n≤...
[演算法] 線性篩
埃拉托斯特尼篩法 我們從大家國一就學過的埃拉托斯特尼篩法開始。 維護一個布林陣列not_prime,索引為iii那欄表示數字iii是否為質數,若為質數則該欄為0,若為合數則為1。 我之所以用0表示質數1表示合數是因為如此可省去初始化填入1的步驟。 而埃拉托斯特尼篩法的邏輯就是先預設所有數都是質數,再一步步把不是的劃掉 因為大家都學過這個篩法的步驟和原理(去問你國中數學老師),以下直接上程式 std::vector<int> prime; bool not_prime[N+1]; void Eratosthenes(int n) { not_prime[0] = not_prime[1] = true; for (int i=2; i<=n; i++) { if (!not_prime[i]) { prime.push_back(i); // 將質數加入 prime if (1LL*i*i > n) continue; for (int j=i*i; j<=n; j+=i) n...
GPN CTF 2026 Writeup
因為考上台大了,這個暑假打算上CTFtime上找一些比賽來打。本來想說畢業當周周末來打這個GPN CTF 2026,結果開賽前突然看到零日餅乾社裡傳一個ISIP-HS CTF,比賽時間包含這個GPN CTF,結果就變成GPN CTF只解了兩三題(還簡單題XD)(都在打ISIP-HS CTF)。 Sanity Check Welcome題,點進Rule看即可 Flag: GPNCTF{Yes Chef! I am ready for a fair competition} Double Fried 題目給了一個pcap檔案,用Wireshark去開 發現訊息有R開頭跟F開頭兩種,而從圖一可以猜出F開頭的是雜訊,所以我們只看R開頭的。 用frame contains "R"進行篩選 然後手動把Flag字母接起來因為我也只會人工接起來 Flag: GPNCTF{NICe, yOu FoUnD 0U7 wHO dID NOt b3L0ng ThEr3} Auto Cooker 把題目給的檔案丟進IDA逆向 int __fastcall main(int a...




![[演算法] 線性篩](/2026/06/11/%E6%BC%94%E7%AE%97%E6%B3%95-%E7%B7%9A%E6%80%A7%E7%AF%A9/ascii_art_2.png)



