首页 > 2020/8/29 19:00 科大讯飞笔试
头像
Ember_Sky
编辑于 2020-08-29 21:12
+ 关注

2020/8/29 19:00 科大讯飞笔试

给定m*n的矩阵,

小明从【1,1】开始走,只能向右或者向下走,最终到达右下角,问经过的点的和最大是多少

输入:

3 3

1 2 3

4 5 6

7 8 9

输出:

29

解释:1 4 7 8 9

//1.

//# include <iostream>

//# include <algorithm>

//# include <string> //字符串类

//# include <array> //静态数组

//# include <vector> //动态数组

//# include <deque> //双向动态数组

//# include <list> //双向链表

//# include <forward_list> //单向链表

//# include <utility> //pair

//# include <set> //集合容器

//# include <unordered_set> //无序set

//# include <map> //键值对容器

//# include <unordered_map> //无序map

//# include <stack> //

//# include <queue> //队列

//# include <cstdio>

//# include <cstdlib> //定义杂项函数和内存分配函数

//# include <cmath> //定义数学函数

//# include <cstring> //字符串处理

//# include <ctime>

////# include <windows.h>

////# include <graphics.h>

////# include <conio.h>

//

//using namespace std;

//

//typedef long long ll;

//

//int s[110][110];

//int f[110][110];

//

//int main() {

// //ios::sync_with_stdio(false);

// //freopen("in.txt", "r", stdin);

//

// int m, n;

// scanf("%d,%d", &n, &m);

// for (int i = 1; i <= n; i++) {

// for (int j = 1; j <= m; j++) {

// cin >> s[i][j];

// }

// }

// for (int i = 1; i <= n; i++) {

// for (int j = 1; j <= m; j++) {

// f[i][j] = max(f[i - 1][j], f[i][j - 1]) + s[i][j];

// }

// }

// cout << f[n][m] << endl;

// return 0;

//}

//


系统使用自带的一个排序算法对序列(258421471527683520)进行排序

过程中进行采样,采样数据如下

158421472527683520

152021252735684784

152021252735476884

请你实现这个算法

输入:

9

258421471527683520

输出:

152021252735476884

//2.

//# include <iostream>

//# include <algorithm>

//# include <string> //字符串类

//# include <array> //静态数组

//# include <vector> //动态数组

//# include <deque> //双向动态数组

//# include <list> //双向链表

//# include <forward_list> //单向链表

//# include <utility> //pair

//# include <set> //集合容器

//# include <unordered_set> //无序set

//# include <map> //键值对容器

//# include <unordered_map> //无序map

//# include <stack> //

//# include <queue> //队列

//# include <cstdio>

//# include <cstdlib> //定义杂项函数和内存分配函数

//# include <cmath> //定义数学函数

//# include <cstring> //字符串处理

//# include <ctime>

////# include <windows.h>

////# include <graphics.h>

////# include <conio.h>

//

//using namespace std;

//

//typedef long long ll;

//

//void charusort(vector<int>& s) {

// int n = s.size();

// for (int i = 0; i < n; i++) {

// int mint = i;

// for (int j = i + 1; j< n; j++) {

// if (s[j] < s[mint]) {

// mint = j;

// }

// }

// swap(s[i], s[mint]);

// }

//}

//

//int main() {

// //ios::sync_with_stdio(false);

// //freopen("in.txt", "r", stdin);

//

// char ch;

// int n; cin >> n;

// vector<int>s(n);

// cin >> s[0];

// for (int i = 1; i < n; i++) {

// cin >> ch >> s[i];

// }

// charusort(s);

// cout << s[0];

// for (int i = 1; i < n; i++) {

// cout << ',' << s[i];

// }

// cout << endl;

// return 0;

//}

//


给定字符串,消除没用的下划线:相邻的,前后的

不能开辟新数组

输入:

___aaa______bsd___sadf___

输出:

aaa_bsd_sadf

//3.

//# include <iostream>

//# include <algorithm>

//# include <string> //字符串类

//# include <array> //静态数组

//# include <vector> //动态数组

//# include <deque> //双向动态数组

//# include <list> //双向链表

//# include <forward_list> //单向链表

//# include <utility> //pair

//# include <set> //集合容器

//# include <unordered_set> //无序set

//# include <map> //键值对容器

//# include <unordered_map> //无序map

//# include <stack> //

//# include <queue> //队列

//# include <cstdio>

//# include <cstdlib> //定义杂项函数和内存分配函数

//# include <cmath> //定义数学函数

//# include <cstring> //字符串处理

//# include <ctime>

////# include <windows.h>

////# include <graphics.h>

////# include <conio.h>

//

//using namespace std;

//

//typedef long long ll;

//

//int main() {

// //ios::sync_with_stdio(false);

// //freopen("in.txt", "r", stdin);

//

// string s; cin >> s;

// while (s.size() && s.front() == '_') s.erase(s.begin());

// s += '_';

// for (int i = 1; i < s.size(); ) {

// if (s[i] == '_' && s[i] == s[i - 1]) {

// s.erase(s.begin() + i);

// }

// else {

// i++;

// }

// }

// while (s.size() && s.back() == '_') s.pop_back();

// cout << s << endl;

// return 0;

//}

//


给定一个数n,输出其所有的素数乘积

使用递归的方法

输入:

100

输出:

2*2*5*5

输入:

12

输出:

2*2*3

//4.

//# include <iostream>

//# include <algorithm>

//# include <string> //字符串类

//# include <array> //静态数组

//# include <vector> //动态数组

//# include <deque> //双向动态数组

//# include <list> //双向链表

//# include <forward_list> //单向链表

//# include <utility> //pair

//# include <set> //集合容器

//# include <unordered_set> //无序set

//# include <map> //键值对容器

//# include <unordered_map> //无序map

//# include <stack> //

//# include <queue> //队列

//# include <cstdio>

//# include <cstdlib> //定义杂项函数和内存分配函数

//# include <cmath> //定义数学函数

//# include <cstring> //字符串处理

//# include <ctime>

////# include <windows.h>

////# include <graphics.h>

////# include <conio.h>

//

//using namespace std;

//

//typedef long long ll;

//

//vector <int> ans;

//void dfs(int n, int i) {

// if (n == 1) return;

// while (n % i != 0) i++;

// ans.emplace_back(i);

// dfs(n / i, i);

//}

//

//int main() {

// //ios::sync_with_stdio(false);

// //freopen("in.txt", "r", stdin);

//

// int n; cin >> n;

// dfs(n, 2);

// cout << ans[0];

// for (int i = 1; i < ans.size(); i++) {

// cout << '*' << ans[i];

// }

// cout << endl;

// return 0;

//}

全部评论

(0) 回帖
加载中...
话题 回帖

相关热帖

历年真题 真题热练榜 24小时
技术(软件)/信息技术类
查看全部

近期精华帖

热门推荐