online-learning
liuhauhau
这个作者很懒,什么都没留下…
展开
-
自测01—打印沙漏
//沙漏 #include<iostream> #include<math.h> using namespace std;int main(){ int i,g=0,m; char c; cin >> i >> c; int j = sqrt((i + 1) / 2); m =i-( 2 * j*j - 1); for (int k = j; k>=原创 2017-10-31 22:17:17 · 515 阅读 · 0 评论 -
自测02—素数对猜想
includeusing namespace std;define MAXLENGTH 50000int main(){ int a[MAXLENGTH]; int flag, n; a[0] = 2; for (int i = 1, k = 3;k<=2*MAXLENGTH; k++){ flag = 1;//flag赋值要在外面,如果是原创 2017-10-31 22:56:42 · 117 阅读 · 0 评论 -
自测03—数组元素循环右移问题
题目:一个数组A中存有N(>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(≥0)个位置, 即将A中的数据由(A0A1⋯AN−1)变换为(AN−M⋯AN−1A0A1⋯AN−M−1)(最后M个数循环移至最前面的M个位置)。 如果需要考虑程序移动数据的次数尽量少,要如何设计移动的方法? 要移动数据次数最少,而且不允许使用另外数组,原创 2017-11-01 23:06:57 · 198 阅读 · 0 评论 -
自测05—Shuffling Machine(自动洗牌机)
题目: Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "inside jobs" where employees collaborate wit原创 2017-11-03 23:00:15 · 341 阅读 · 0 评论