一、填空

侧重逻辑思维,没有语言、具体技术考察,大部分属于组合数学、算法。比较基本的知识点有二元树节点树、最小生成树、Hash函数常用方法等。

二、编程题

1、正整数剖分

2、AOE关键路径

3、二元树前序、中序求后序

4、大整数加

//正整数剖分
#include <stdio.h> int func(int n, int k, int max)
{
int min = (int)((n+k-)/k);
if(k==)
return ;
int count = ;
for(int i=min;i<max;i++){
count += func(n-i, k-, max-i);
}
return count;
} int main()
{
int ans;
int i = ;
//ans = func(10, 3, 10);
ans = func(, , );
printf("%d\n", ans); return ;
}
//AOE
#include <stdio.h>
#include <stdlib.h>
#include <string.h> void AOE(int adj[][], int n)
{
int *e = (int*)malloc(sizeof(int)*n);
int *l = (int*)malloc(sizeof(int)*n);
e[]=;
for(int i=;i<n;i++){
int max = ;
for(int j=;j<i;j++){
if(adj[j][i]!= && adj[j][i]+e[j]>max){
max = adj[j][i] + e[j];
}
}
e[i]=max;
}
l[n-]=e[n-];
for(int i=n-;i>=;i--){
int min = ;
for(int j=n-;j>i;j--){
if(adj[i][j]!= && l[j]-adj[i][j]<min){
min = l[j]-adj[i][j];
}
}
l[i]=min;
}
for(int i=;i<n;i++){
if(e[i]==l[i])
printf("%d\t", i+);
}
printf("\n");
free(e);
free(l);
}
int main()
{
const int size = ;
int adj[size][size];
memset(adj, , sizeof(int)*size*size);
adj[][] = , adj[][]=, adj[][]=;
adj[][] = , adj[][]=, adj[][]=;
adj[][] = , adj[][]=, adj[][]=;
adj[][] = , adj[][]=; AOE(adj, size); return ;
}
//二元树前序、中序打印后序
#include <stdio.h>
#include <cstring>
#include <stack>
using namespace std;
void dumpPost(const char* pre, const char* mid)
{
int n = strlen(pre);
if(n==){
printf("%c\t", pre[]);
return;
}
int i;
for(i=;i<n;i++){
if(mid[i]==pre[])
break;
}
char lpre[i], lmid[n-i-];
char rpre[i], rmid[n-i-];
memcpy(lpre, pre+, sizeof(char)*i);
memcpy(lmid, mid, sizeof(char)*i);
memcpy(rpre, pre+i+, sizeof(char)*(n-i-));
memcpy(rmid, mid+i+, sizeof(char)*(n-i-));
lpre[i] = lmid[i] = '\0';
rpre[n-i-] = rmid[n-i-] = '\0';
dumpPost(lpre, lmid);
dumpPost(rpre, rmid);
printf("%c\t", pre[]);
}
int main()
{
const char* preOrder = "ABDEC";
const char* midOrder = "DBEAC";
const char* postOrder = "DEBCA"; dumpPost(preOrder, midOrder);
printf("\n"); return ;
}
//大整数运算
#include <stdio.h>
#include <stdlib.h>
#include <string.h> void strrev(char* s)
{
int i=-;
while(s[++i]!='\0');
for(int j=;j<i/;j++){
char tmp = s[j];
s[j] = s[i-j-];
s[i-j-]=tmp;
}
}
void Add(const char*str1, const char* str2, char* ans)
{
int l1, l2, l;
l1 = strlen(str1);
l2 = strlen(str2);
l = l1>l2 ? l1 : l2;
char* s1 = (char*)malloc(sizeof(char)*(l1+));
char* s2 = (char*)malloc(sizeof(char)*(l2+));
memcpy(s1,str1,(l1+)*sizeof(char));
memcpy(s2,str2,(l2+)*sizeof(char));
strrev(s1);
strrev(s2);
int i;
int sum, carry;
i=sum=carry=;
while(i<l){
char a = i<l1?s1[i]:'';
char b = i<l2?s2[i]:'';
sum = a-''+b-'' + carry;
ans[i] = sum % + '';
carry = sum / ;
i++;
}
if(carry!=)
ans[i++]=carry+'';
ans[i]='\0';
strrev(ans);
free(s1);
free(s2);
}
void Mul(const char*str1, const char* str2, char* ans)
{
int l1, l2, l;
l1 = strlen(str1);
l2 = strlen(str2);
l = l1 + l2;
ans[]='\0';
char* s1 = (char*)malloc(sizeof(char)*(l1+));
char* s2 = (char*)malloc(sizeof(char)*(l2+));
memcpy(s1,str1,(l1+)*sizeof(char));
memcpy(s2,str2,(l2+)*sizeof(char));
strrev(s1);
strrev(s2);
char* tmp = (char*)malloc(sizeof(char)*(l1+));
int s, carry;
s = carry = ;
for(int i=;i<l2;i++){
int j;
for(int j=;j<i;j++)
tmp[j]='';
for(j=;j<l1;j++){
s = (s1[j]-'')*(s2[i]-'')+carry;
tmp[i+j]=s%+'';
carry=s/;
}
if(carry!=)
tmp[i+j++]=carry+'';
tmp[i+j]='\0';
strrev(ans);
strrev(tmp);
Add(ans,tmp, ans);
strrev(ans);
}
strrev(ans);
}
int main()
{
const char a[] = "";
const char b[] = "";
char c[]; Add(a,b,c);
printf("a+b=%s\n", c);
Mul(a,b,c);
printf("a*b=%s\n", c); return ;
}

2012Hulu校园招聘笔试题的更多相关文章

  1. 2014 WAP校园招聘笔试题

    2014 WAP校园招聘笔试题 Problem's Link:   http://www.doc88.com/p-6751117015483.html WAP公司笔试题 We are planning ...

  2. google2013校园招聘笔试题(全国)

    google2013校园招聘笔试题 1. 单项选择题1.1如果把传输速率定义为单位时间内传送的信息量(以字节计算)多少.关于一下几种典型的数据传输速率:1.使用USB2.0闪存盘,往USB闪存盘上拷贝 ...

  3. Microsoft 2013校园招聘笔试题及解答

    Microsoft 2013校园招聘笔试题及解答 题目是自己做的,求讨论.吐槽.拍砖 1.      Which of the following callingconvension(s) suppo ...

  4. Microsoft2013校园招聘笔试题

    Microsoft2013校园招聘笔试题 继续求拍砖!!!! 1. You are managing the database of a book publichser, you currently ...

  5. C# - 2017微软校园招聘笔试题 之 MS Recognition[待解决]

    MS Recognition 在线提交: hihoCoder 1402 http://hihocoder.com/problemset/problem/1402 类似: OpenJudge - I:P ...

  6. 京东2017校园招聘笔试题 【第K个幸运数】

    题目描述 4和7是两个幸运数字,我们定义,十进制表示中,每一位只有4和7两个数的正整数都是幸运数字. 前几个幸运数字为:4,7,44,47,74,77,444,447... 现在输入一个数字K,输出第 ...

  7. 九度OJ 1531 货币面值(网易游戏2013年校园招聘笔试题) -- 动态规划

    题目地址:http://ac.jobdu.com/problem.php?pid=1531 题目描述: 小虎是游戏中的一个国王,在他管理的国家中发行了很多不同面额的纸币,用这些纸币进行任意的组合可以在 ...

  8. PPS2013校园招聘笔试题

    转载请标明出处,原文地址:http://blog.csdn.net/hackbuteer1/article/details/11473405 一.简答题 (1)一位老师有2个推理能力很强的学生,他告诉 ...

  9. Microsoft2013校园招聘笔试题及解答

    继续求拍砖!!!! 1. You are managing the database of a book publichser, you currently store the book orders ...

随机推荐

  1. 更改MySQL数据库目录位置[zz]

    MYSQL默认的数据文件存储目录为/var/lib/mysql.假如要把目录移到/home/data下需要进行下面几步:1.home目录下建立data目录cd /homemkdir data2.把My ...

  2. svm工具箱快速入手简易教程

    首先svm是用来做分类的,是一种有监督的分类器. 什么是有监督的呢?就是说在你给我一个数据集让我做分类之前.我已经有一些经验数据了.即要先进行学习,再进行分类. 这里就有了训练集和测试集.先用训练集来 ...

  3. Processing支持中文显示

    Processing 默认不支持中文,中文显示成框框,我使用的版本是:2.2.1,进行如下设置,并且重启processing就可以支持中文了: 可以看到中文了:

  4. supervisor 安装脚本

    mkdir /data/tools && cd /data/tools wget --no-check-certificate https://bootstrap.pypa.io/ez ...

  5. Java常考面试题(五)

    序言 好好努力. ---WH 一.Iterator和ListIterator的区别是什么? 自我解答: Iterator是针对所有collection来使用的,而看名字ListIterator,顾名思 ...

  6. PostgreSQL PL/Python 和 PL/Postgres 函数互相调用

    create or replace function hello(name text) returns text as $$ # str = name+',你吃饭了吗?'; # return 'hel ...

  7. App开放接口API安全性 — Token签名sign的设计与实现

    在app开放接口API的设计中,避免不了的就是安全性问题. 一.https协议 对于一些敏感的API接口,需要使用https协议. https是在http超文本传输协议加入SSL层,它在网络间通信是加 ...

  8. 实战mysql分区

    前些天拿到一个表,将近有4000w数据,没有任何索引,主键.(建这表的绝对是个人才) 这是一个日志表,记录了游戏中物品的产出与消耗,原先有一个后台对这个表进行统计.....(这要用超级计算机才能统计得 ...

  9. python-zip方法

    zip 返回一个将多个可迭代对象组合成一个元组序列的迭代器. 1.  循环多个list的数据: letters = ['a', 'b', 'c'] nums = [1, 2, 3] for lette ...

  10. PBR Metallic/Roughness工作流中Albedo与F0的计算方法

    首先简单回顾一下典型的纯金属与绝缘体的PBR属性: 纯金属: Albedo(diff): 0 F0(spec): >0.3 (or 0.5, epic/allegorithmic etc.) M ...