一组百度笔试题
来源:互联网 发布:绘制架空世界地图软件 编辑:程序博客网 时间:2024/04/28 23:55
1. 有一箱苹果,3个一包还剩2个,5个一包还剩3个,7个一包还剩2个,求N个满足以上条件的苹果个数。
#include <stdlib.h>void find(int n){int i;for(i = 0; i <= n; i++){if((i - 2) % 3 == 0 && (i - 3) % 5 == 0 && (i - 2) % 7 == 0){printf("%d \n", i);}}}int main(){find(1000);}
2. 用递归算法写一个函数,求字符串最长连续字符的长度,比如aaaabbcc的长度为4,aabb的长度为2,ab的长度为1。
#include <stdlib.h>char c[100] = "aabbbasdfadfsdfdddssasddddd";int max = 0;void findMax(char *c){int i = strlen(c) - 1;int tempMax = 1;char temp = c[i];if(i < 0){return;}while(i-- >= 0){if(c[i] == temp){++tempMax;}else{max = max < tempMax ? tempMax : max;c[++i] = '\0';break;}}findMax(c);}int main(){findMax(c);printf("%d",max);}
- 一组百度笔试题
- 【算法题】百度笔试题——求一组线段的最大重叠区域
- 百度网上笔试题
- 百度网上笔试题
- 百度网上笔试题
- 百度笔试题
- 百度网上笔试题
- 百度笔试题
- 2006百度笔试题
- 百度网上笔试题
- 百度笔试题
- 2007百度笔试题
- 百度笔试题 [软件工程师]
- 百度笔试题
- 2007百度笔试题
- 百度部分笔试题
- 08百度笔试题
- 08百度笔试题
- 分析 "ADO" "ADODB" "ADODC" 之间的区别与联系
- C++中的类模板
- libev源码分析1
- Android中设置程序全屏运行,即不显示程序标题
- Ubuntu下彻底卸载MySQL(以Ubuntu12.04为例)
- 一组百度笔试题
- [python]modules for kindle[update...]
- Poj 2723(two-sat)
- zoj 1051 A New Growth Industry
- hdu 4715 Difference Between Primes(stl)
- JavaEE中使用Filter来实现图片的防盗链
- C# 数据库dataGridView刷新数据和主外键判断
- 2014华为校园招聘 机试 第三题
- 汇率的本质