sysprog
contributed by < sciyen
>
for (int i = 0; i < arr_size; i++) {
int k = 0;
int len = strlen(arr[i]);
for (int j = 0; j < len; j++)
// Translate characters into bitwise composition
k |= 1 << (arr[i][j] - 'a');
if (__builtin_popcount(k) != len) continue;
// Add into potential list (a[])
a[i] = k;
}
Example of translating characters into bitwise composition:
a -> 0b00000000000000000000000001
z -> 0b10000000000000000000000000
char -> 0b00000000100000000010000101
Note,重複的字串無法符合題目條件的字串描述,因此無法加入參考選項。當 1
的個數比 字元數量
還少,表示字元內容有重複。因此跳過下一行的
a[i] = k;
該程式碼利用 mmap()
將檔案映射到記憶體,實現高效率的檔案複製。
src = mmap(NULL, len, PROT_READ, MAP_SHARED, src_fd, 0);
將 destination 映射到記憶體
dst = mmap(NULL, len, PROP_READ | PROP_WRITE, MAP_SHARED, dst_fd, 0);
檔案複製原本是 low level IO 操作,變成記憶體複製,可以利用例如
等方式做資料複製。
for (size_t i = 0; i < len; i += page_size) {
size_t block_size = (len - i) >= page_size ? page_size : (len - i);
// if content is different
if (memcmp(src + i, dst + i, block_size)) {
// copy them with memcpy()
memcpy(dst + i, src + i, block_size);
write_count += block_size;
}
read_count += block_size;
}
Firstly, use IguanaTex to generate equations (Latex Display) in MS PowerPoint. You can set a larger dpi for a higher quality output. Select the "Reset size" option to ensure the consistency of font size. image Copy and paste it to MS Publiser. Drag the figure by holding its center (right on the logo), otherwise, the auto arranging feature will make you frustrated. image Set the figure format. Firstly, Select the "Inline with text" option in the "Wrap Text" menu. And then select the "More Layout Options" in the "Wrap Text" menu. image Set the figure format. Cancel the auto checkbox. Adjust the bottom distance as your needs. The value varies in different Latex Displays. image Now, the figure object, i.e., the equation, can be treated just like normal characters. You can drag it among words with spacing settings as you set for a paragraph. image
Oct 10, 2024在軍中,洗餐盤洗得乾淨不油膩是基本,但邊緣角落累積的陳年汙垢,洗起來費力費時,就很多人不願去理會 (畢竟洗完餐盤後的一分一秒可能攸關洗澡時排隊的人流長度呢)。每次我在洗餐盤,都在想到底是不是要多花點心思刷掉頑強的汙垢,到底我下次再拿到相同餐盤的機率是多少呢?
Oct 10, 2024contributed by < sciyen >repository on github
Nov 29, 20232020 KGHS i2trc2 26th (下) 基礎程式組 積點/作業/專題/分組 這學期的大綱 積點兌換表 Processing 下載連結 作業上傳雲端連結 每個禮拜都會有作業喔,大家記得交 ww
Jul 27, 2021or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up