2018年小米校招笔试题
来源:互联网 发布:word数据转换成excel 编辑:程序博客网 时间:2024/05/15 23:43
我们设计了整数三角形,每一行都比上一行多出一个数,而每个数字都等于它上方与左上方两个数字之和,给出一个数字,求最先出现在哪一行
#include<iostream>#include<stdlib.h>#include<string.h>#define maxn 30int a[maxn][maxn];int main(){ using namespace std; int z=0, x, y,tot=1; int n; memset(a, 0, sizeof(a)); for (int i = 1; i < maxn; ++i) { a[i][1] = tot; } for (int x = 2; x < maxn; ++x) { for (int y = 2; y < maxn; ++y) a[x][y] = a[x - 1][y] + a[x - 1][y - 1]; } cin >> n; for (int c = 0; c < maxn; ++c) { for (int b = 0; b < maxn; ++b) { if (a[c][b] == n) { z = c; break; } else continue; } if (z) { cout << z; break; } else continue; } system("pause"); return 0;}
阅读全文
0 0
- 2018年小米校招笔试题
- 2016小米校招笔试题
- 小米校招笔试题(java)
- 【2014校招】小米笔试
- 2015小米校招技术类笔试题
- 小米 2012 春季校招 笔试
- [小米2015校招笔试]回文数
- [小米2015校招笔试]多项式乘积
- 校招笔试题
- 2018网易游戏校招笔试题
- 阿里巴巴2018校招笔试题
- 阿里2018校招笔试编程题
- 广联达2018校招笔试题
- 大疆2018校招笔试题
- 百词斩2018校招笔试题
- 搜狐2018校招笔试题
- 【网易】2018校招笔试题
- 2015年阿里巴巴校招笔试题
- SSM框架mapper文件夹由resource目录转入java目录后服务器上访问不到404
- 新广告法禁用词汇,各类极限用语整理汇总
- 写给自己
- 无须对抗分心也能更专注(笔记)
- 华为P9移动定制版刷为联通移动双4G版本
- 2018年小米校招笔试题
- Pythonic Data Structures and Algorithms(Array 4)
- C# DataTable中的计算函数
- explicit关键字和隐式的类类型转换
- 数据库中常用的约束和约束作用
- 有关Mysql1067错误的一点难过经历
- 记录工作中的奇葩事儿
- 检查一个变量是否是数字或者数字字符串
- freemarker合并单元格