2023年北郵計算機專業課機試

2021-08-17 23:07:47 字數 1991 閱讀 1741

//2023年計算機學院機試 a 二叉排序樹 

//2018/3/3

//by ben yafang

//done

#include#includeusing namespace std;

struct node *root;

void insert(node *root,int x)

} else }}

int main()

}return 0;

}

//2023年計算機學院機試 b 二進位制 

//2018/3/3

//by ben yafang

//done

//ac

#includeint a[10005]; //儲存轉換二進位制的0/1

int len;

int main()

for(int i = len-1;i >= 0;i--) printf("%d",a[i]);

printf("\n");

} } }

//2023年計算機學院機試 d ip資料報解析 

//2018/3/20

//by ben yafang

//doing

//gets strtol進製轉換

#include#include#include#includeusing namespace std;

int ip_length(char ip,int start,int n)

pre_ip[index] = '\0';//最後要賦值結束符

return strtol(pre_ip,null,16); //16進製制轉換成10進製

//stdlib

}void ip_address(char ip,int start,int n)

} printf("\n");

} int main()

}ip[j] = '\0';

printf("case #%d\n",index);

int length = ip_length(ip,4,4);//從第4位開始,一共4位

printf("total length = %d bytes\n",length);

printf("source = ");

ip_address(ip,24,8);

printf("destination = ");

ip_address(ip,32,8);

int addr = ip_length(ip,1,1) * 4 * 2;

printf("source port = %d\n",ip_length(ip,addr,4));

printf("destination port = %d\n",ip_length(ip,addr+4,4));

} }}

//2023年計算機學院機試 c 矩陣冪 

//2018/3/3

//by ben yafang

//done 全域性變數 函式傳參

#include#include//using namespace std;

int n;//定義n為全域性變數,以便在函式中呼叫

int input[10][10];//儲存輸入資料

int temp[10][10];//儲存計算過程中的中間資料

int result[10][10]; //儲存輸出結果 同時參與下一次運算

void matrixmultiply()

} }

for(i = 0;i < n;i++)

}} int main()

} k--;//k=1時不進行函式運算

while(k--)

for(i = 0;i < n;i++)

} }

}

2023年考研專業課基礎複習 計算機

對報考計算機專業的廣大考生而言,除了政治 英語 數學三門公共課之外,對最終成績舉足輕重的計算機統考專業課的複習同樣是 先下手為強 基礎階段複習,顧名思義,以夯實基礎知識 掌握基本解題方法為重。萬學海文專業課輔導老師們提醒2012年的考生們這一階段的複習需著重注意以下幾方面的問題 1.階段複習目標 了...

19北郵計算機院機試

32位二進位制數 x 對其進行x 1,x 3操作,並輸出。注意不能忽略前導0。輸入 第一行,乙個整數 t 代表測試資料組數。接著 t 行,輸入32為二進位制數輸出對每組測試資料。輸出兩行,第一行為x 1,第二行為x 3.測試樣例輸入2 00000000000000000000000000000000...

2023年北郵機試真題(計算機 or 網研 )

問題描述 給你乙個長度為m的陣列 陣列元素從0到m 1 如果陣列裡有a i a j a k i,j,k大於等於0並且小於m 便稱之為三元組。現在給你乙個陣列,讓你求三元組的個數。例如m為2,裡面的元素為 0,0 那麼三元組為 a 0 a 0 a 0 a 0 a 0 a 1 a 0 a 1 a 0 a...