当前位置: 首页 > 面试经验 >

百度0307网络系统工程师笔试

优质
小牛编辑
150浏览
2023-03-28

百度0307网络系统工程师笔试

选择题+设计题+编程题

考了相当多的安全相关的知识,对称加密、非对称加密,中间人攻击;

证书的认证,签名,hash256算法等等;

编程一道:

张小度要零花钱,给定一个数n,求能要到n元的方案数目,结果对1000000007求余;

如n = 100, 可以100次要1元,也可以1次要100元;

易知 f(n) = f(1) + f(2) + ... + f(n-1) + 1;


public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
System.out.println(solve(n));
}
public static long solve(int n) {
long sum = 0;
if(n == 1) return 1;
for (int i = 1; i < n; i++) {
sum += solve(i);
}
return sum + 1;
}

}

#百度#
 类似资料: