- 博客(23)
- 资源 (2)
- 收藏
- 关注
原创 Tic-tac-toe
DescriptionIn the game of tic-tac-toe, two players take turns marking squares of an initially empty 3 × 3 grid with either X’s or O’s. The first player always marks squares using X’s, whereas the seco...
2018-05-28 21:58:01 20602
原创 QQ Account Management
QQ Account ManagementYou are supposed to implement the functions of account "Log in" and "Register" for the most popular instant messager QQ. The most challenging part is that QQ now has more than a ...
2018-05-28 20:30:35 1322
原创 数组循环左移
数组循环左移(20 分)本题要求实现一个对数组进行循环左移的简单函数:一个数组a中存有n(>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向左移m(≥0)个位置,即将a中的数据由(a0a1⋯an−1)变换为(am⋯an−1a0a1⋯am−1)(最前面的m个数循环移至最后面的m个位置)。如果还需要考虑程序移动数据的次数尽量少,要如何设计...
2018-05-26 22:40:07 1090 1
原创 两个有序序列的中位数(30 分)
已知有两个等长的非降序序列S1, S2, 设计函数求S1与S2并集的中位数。有序序列A0,A1,⋯,AN−1的中位数指A(N−1)/2的值,即第⌊(N+1)/2⌋个数(A0为第1个数)。输入格式:输入分三行。第一行给出序列的公共长度N(0<N≤100000),随后每行输入一个序列的信息,即N个非降序排列的整数。数字用空格间隔。输出格式:在一行中输出两个输入序列的...
2018-05-26 20:25:57 3767
原创 两个有序链表序列的合并
两个有序链表序列的合并已知两个非降序链表序列S1与S2,设计函数构造出S1与S2的并集新非降序链表S3。输入格式:输入分两行,分别在每行给出由若干个正整数构成的非降序序列,用−1表示序列的结尾(−1不属于这个序列)。数字用空格间隔。输出格式:在一行中输出合并后新的非降序链表,数字间用空格分开,结尾不能有多余空格;若新链表为空,输出NULL。输入样例:1 3 5 -12 4 6 8 10 -1...
2018-05-26 10:17:08 1860
原创 冒泡排序
冒泡排序(10 分)编程实现冒泡排序函数。void bubbleSort(int arr[], int n);。其中arr存放待排序的数据,n为数组长度(1≤n≤1000)。函数接口定义如下:/* 对长度为n的数组arr执行冒泡排序 */void bubbleSort(int arr[], int n);请实现bubbleSort函数,使排序后的数据从小到大排列。裁判测试程序样例:#incl...
2018-05-26 09:13:00 7036
原创 数组元素的区间删除
6-3 数组元素的区间删除(15 分)给定一个顺序存储的线性表,请设计一个函数删除所有值大于min而且小于max的元素。删除后表中剩余元素保持顺序存储,并且相对位置不能改变。函数接口定义:int Delete( int A[], int L, int minA, int maxA );其中A是整型数组,存储原始线性表的元素;L是表长,即A中元素的个数;minA和maxA分别为待删除元素的值域的下...
2018-05-26 09:11:38 7339 2
原创 保存一下
七桥问题的并查集解法https://blog.csdn.net/a664607530/article/details/60887449https://www.cnblogs.com/joeylee97/p/6005488.html
2018-05-15 17:40:19 139
原创 二叉搜索树
#include <iostream>#include<vector>#include<cstdio>#include<string>using namespace std;void solve(vector<int> v, int c[]){ for (int i = 0; i<v.size(); i++) {...
2018-05-15 17:35:20 140
原创 Calendar
CalendarTime Limit: 1000 ms / Memory Limit: 30000 kbDescriptionA calendar is a system for measuring time, from hours and minutes, to months and days, and finally to years and centuries. The terms of h...
2018-05-15 17:34:22 252
原创 What Day Is It?
What Day Is It?Time Limit: 2 Seconds Memory Limit: 65536 KBThe calendar now in use evolved from the Romans. Julius Caesar codified a calendar system that came to be known as the Julian calendar. ...
2018-05-15 17:34:10 868
原创 What day is it
DescriptionToday is Saturday, 17th Nov,2007. Now, if i tell you a date, can you tell me what day it is ?InputThere are multiply cases.One line is one case.There are three integers, year(0<year<1...
2018-05-15 17:34:00 358
原创 反转数
Adding Reversed NumbersTime Limit: 1000 ms / Memory Limit: 10000 kbDescriptionThe Antique Comedians of Malidinesia prefer comedies to tragedies. Unfortunately, most of the ancient plays are tragedies....
2018-04-07 13:53:20 667
原创 士兵队列训练问题
士兵队列训练问题Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : Accepted Submission(s) : Problem Description某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:...
2018-03-29 20:46:03 992
原创 Polish notation
Polish notationReverse Polish notation (RPN) is a method for representing expressions in which the operator symbol is placed after the arguments being operated on. DescriptionPolish notation, in which...
2018-03-25 16:51:37 311
原创 Fence Repair(哈夫曼算法+优先队列
Fence Repair Time Limit: 2000 ms / Memory Limit: 65536 kb DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs
2017-07-11 23:28:34 449
原创 模拟窗口消息队列
DescriptionMessage queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If something happens to this process, such as mouse click, text change, t
2017-07-11 19:39:26 497
原创 后缀数求值
后缀数求值: 后缀表达式求值的算法:step1:设置一个空栈;step2:从左到右扫描这个栈;step3; 如遇到操作数则入栈,若遇到运算符则从栈中退出两个元素(退一个出栈一次);step4:先退出的元素放在运算符右边,后退出的元素放到运算符左边;strp5:运算结果入栈;step6:回到step2,直到遍历完表达式 (循环表达式:3+(2-5)*6/3后缀表达式:3 2 5 - 6 3 / * ...
2017-07-11 19:27:57 439
原创 十进制和任意进制的转换
=======================s.push()入栈s.top()取栈顶元素s.pop()出栈s.empty()栈不为空=======================1.十进制转换成八进制/二进制#include#include//#include"windows.h"using namespace std;int m
2017-07-11 19:07:06 585
原创 求某个范围内的所有素数(内含埃氏筛法
Description 求小于n的所有素数,按照每行10个显示出来。 Input 输入整数n(nOutput 每行10个依次输出n以内的所有素数。如果一行有10个素数,每个素数后面都有一个空格,包括每行最后一个素数。 Sample Input 100 Sample Output 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47
2017-07-10 22:51:15 1356
原创 zhx's contest
Time Limit: 1000 ms / MemoryLimit: 65536 kbDescriptionAs one of the most powerfulbrushes, zhx is required to give his juniors $n$ problems.zhx thinks the $i^{th}$ problem's difficulty is $i$.
2017-07-10 21:27:55 335
原创 快速幂取模
快速幂取模(快速的求一个幂式的模(余),通常是大数取余的运算 1.模运算:(a+b)%m=(a%m+b%m)%m(a-b)%m=(a%m-b%m)%m(a*b)%m=(a%m*b%m)%m2.位运算: & 按位与 >> 右移,正数高位补0,负数由计算机决定按位与运算按位与运算
2017-07-10 20:51:10 615
原创 快速乘取模运算
**基于快速幂(见上篇**ll mul_mod(ll a, ll n){ ll ans = 0; while (n) { if (n & 1) ans = (ans + a) % mod; a = (a + a) % mod; n /= 2; } return ans;}
2017-07-10 20:45:24 938
酒店宾馆管理系统
2018-06-10
高通工具导入QCN方法
2018-05-06
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人