![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
作业TAT
文章平均质量分 72
椰椰_Aug
红名
梦里..
展开
-
7-24 跳马问题 (10分)
马在中国象棋以日字形规则移动。请编写一段程序,给定n×m大小的棋盘,以及马的初始位置(x,y),要求不能重复经过棋盘上的同一个点,计算马可以有多少途径遍历棋盘上的所有点。输入格式:第一行为整数T(T < 10),表示测试数据组数。每一组测试数据包含一行,为四个整数,分别为棋盘的大小以及初始位置坐标n,m,x,y。(0≤x≤n-1,0≤y≤m-1, m < 10, n < 10)。输出格式:每组测试数据包含一行,为一个整数,表示马能遍历棋盘的途径总数,0为无法遍历一次。输入样例原创 2020-12-18 11:12:26 · 631 阅读 · 0 评论 -
7-5 循环日程表 (10分)
设有N个选手进行循环比赛,其中N=2M,要求每名选手要与其他N−1名选手都赛一次,每名选手每天比赛一次,循环赛共进行N−1天,要求每天没有选手轮空。输入格式:输入:M(M<=7)。输出格式:输出:表格形式的比赛安排表。一行各数据间用一个空格隔开。输入样例:3输出样例:1 2 3 4 5 6 7 8 2 1 4 3 6 5 8 7 3 4 1 2 7 8 5 6 4 3 2 1 8 7 6 5 5 6 7 8 1 2 3 4 6 5 8 7 2 1 4 3 7 8 5原创 2020-12-18 10:51:57 · 634 阅读 · 0 评论 -
7-10 矩阵连乘问题 (10分)
给定n个矩阵{A1,A2,…,An}(n<=20),其中Ai与Ai+1是可乘的,i=1,2…,n-1。第i个矩阵的维数用pi−1,pi来表示。如何确定计算矩阵连乘积的计算次序,使得依此次序计算矩阵连乘积需要的数乘次数最少。例如,给定三个连乘矩阵{A1,A2,A3}的维数数组p为:10,100,5,50,即分别是10 ×100,100×5和5×50,采用(A1A2)A3,乘法次数为10×100×5+10×5×50=7500次,而采用A1(A2A3),乘法次数为100×5×50+10×100×原创 2020-12-18 10:50:17 · 711 阅读 · 0 评论 -
7-11 LIS (10分)
The Longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements of the subsequence are sorted in increasing order. For example, the length of LIS for {10, 22, 9, 33, 21, 50, 41, 6原创 2020-12-18 10:47:35 · 102 阅读 · 0 评论 -
7-12 LCS (10分)
Longest common subsequence (LCS) problem:Given two sequences X[1 . . m] and Y[1 . . n], finding a longest subsequence common to X and Y sequences both. It differs from the longest common substring problem,subsequences are not required to occupy consecutive原创 2020-12-18 10:45:56 · 162 阅读 · 0 评论 -
7-13 knapsack problem (10分)
Given items of different weights and values, we need find the most valuable set of items that fit in a knapsack of fixed capacity . More details: there are a knapsack of capacity c > 0 and n items(c<1000,n<100). Each item has weight wi > 0 and原创 2020-12-18 10:39:56 · 142 阅读 · 0 评论 -
7-19 单源点最短路(Dijkstra) (10分)
7-19 单源点最短路(Dijkstra) (10分)Y老师被邀请参加一个会议,是在城市n(n<=2000),而Y老师当前所处的城市为1,附近还有很多城市2~n-1,有些城市之间没有直接相连的路,有些城市之间有直接相连的路,这些路都是双向的,当然也可能有多条。现在给出直接相邻城市的路长度,Y老师想知道从城市1到城市n,最短多少距离。输入格式:输入n, m,表示n个城市和m(m<=100000)条路;接下来m行,每行a b c, 表示城市a与城市b有长度为c(c<=1000)的路。原创 2020-12-17 14:50:13 · 463 阅读 · 0 评论 -
7-23 翻转车牌 (10分)
7-23 翻转车牌 (10分)有一个奇数位(如5位)的车牌号,由基本数字(0~9)组成,问有多少车牌翻转180度后号码还是原来的车牌并且各位数字之和能被3整除。(csp-s2019初试题)输入格式:一个数字:n(<10),表示车牌号位数输出格式:输出所有满足要求的车牌号码(按字典序排列,每行一个号码),最后一行是满足要求的车牌号总数。输入样例:3输出样例:0001116098889065当有一半的数字确定后,可以翻转确定另一半数字。所以操作次数只有m=n/2+0.5次原创 2020-12-10 19:34:52 · 1622 阅读 · 2 评论 -
7-21 逆序数 (10分)
7-21 逆序数 (10分)设x1,x2,x3…,xn是集合{1,2,3,…,n}的一个排列,排列中逆序对的对数称为逆序数,(如1432的逆序数为3,即有3对逆序对,分别为:43,42,32)。则当x3=4时(即第3个数为4),所有排列的逆序数的和为多少?(n=6时,为2020年全国高中数学联赛浙江赛区初赛试题填空第10题)输入格式:输入一个n。输出格式:输出逆序数的和。输入样例:6输出样例:912#include<bits/stdc++.h>using namespace原创 2020-12-10 14:48:20 · 2033 阅读 · 3 评论 -
7-22 n queens (10分) 八皇后(n皇后)问题
7-22 n queens (10分)there is a chess board with n rows and n columns, you need place n queens in the board,there are no two queens in the same line(include diagonals).input specification:input one integer n denotes n queens .output specification:place原创 2020-12-03 22:39:19 · 564 阅读 · 1 评论 -
7-20 full permutation (10分)
there is an integer n,that means there are n numbers from 1 to n,then output the full permutation about the first n nature number.input specification:input one integer n.output specification:list the full permutation about the first n numbers with dict原创 2020-12-03 20:58:12 · 153 阅读 · 0 评论 -
7-17 Horse Racing (25分) 赛马
There is a horse racing between QW and TJ. SB is to be the judge. QW and TJ both have horses. Each horse has an ability that is different from any other one. They arrange their horses in a fixed order. The first horse of QW’s will compete to the first of T原创 2020-12-03 20:50:12 · 653 阅读 · 0 评论 -
7-18 删数问题 (10分) 大数
输入一个高精度的正整数n,去掉其中任意s个数字后剩下的数字按原左右次序组成一个新的正整数。编程对给定的n和s,寻找一种方案使得剩下的数字组成的新数最小。输出新的正整数。(n不超过240位)输入数据均不需判错。输入格式:n和s输出格式:最后剩下的最小数,注意前导0不要输出。输入样例:1764384输出样例:在这里给出相应的输出。例如:13...原创 2020-12-03 20:46:03 · 524 阅读 · 0 评论 -
7-8 Score Processing (10分)
Write a program to process students score data.The input of your program has lines of text, in one of the two formats:Student’s name and student id, as <student id>, <name>, andScore for one student of one course, as <student id>, <原创 2020-12-03 20:41:19 · 3480 阅读 · 7 评论 -
中国大学MOOC数据库系统概论中国人民大学实验三 触发器
实验题基于学生选课数据库,其包含三个关系模式:(1)学生关系模式Student(Sno, Sname, Ssex, Sage,Sdept)(2)课程关系模式Course(Cno, Cname, Cpno, Ccredit)(3)选课关系模式SC(Sno, Cno, Grade)其中,学生关系模式各字段的含义为Sno:学号,Sname:姓名,Ssex:性别,Sage:年龄,Sdept:所在系。课程关系模式各字段的定义为Cno:课程号,Cname:课程名,Cpno:先行课,Ccredit:学分。选.原创 2020-07-03 19:58:17 · 1316 阅读 · 0 评论 -
中国大学MOOC数据库系统概论中国人民大学实验二 多表查询
数据库系统概论实验评分系统链接实验题基于学生选课数据库,其包含三个关系模式:(1)学生关系模式Student(Sno, Sname, Ssex, Sage,Sdept)(2)课程关系模式Course(Cno, Cname, Cpno, Ccredit)(3)选课关系模式SC(Sno, Cno, Grade)其中,学生关系模式各字段的含义为Sno:学号,Sname:姓名,Ssex:性别,...原创 2020-04-23 15:38:21 · 2422 阅读 · 1 评论 -
中国大学MOOC数据库系统概论中国人民大学实验一 单表查询
数据库系统概论实验评分系统链接实验题基于学生选课数据库,其包含三个关系模式:(1)学生关系模式Student(Sno, Sname, Ssex, Sage, Sdept)(2)课程关系模式Course(Cno, Cname, Cpno, Ccredit)(3)选课关系模式SC(Sno, Cno, Grade)其中, 学生关系模式各字段的含义为Sno:学号,Sname:姓名,Ssex:性别...原创 2020-04-23 15:14:20 · 1573 阅读 · 0 评论 -
线性表练习作业
线性表练习1-1对于顺序存储的长度为N的线性表,访问结点和增加结点的时间复杂度分别对应为O(1)和O(N)。T作者: DS课程组单位: 浙江大学1-1答案正确(2 分)1-2对于顺序存储的长度为N的线性表,删除第一个元素和插入最后一个元素的时间复杂度分别对应为O(1)和O(N)。F作者: 徐镜春单位: 浙江大学1-2答案正确(2 分)1-3循环链表不是线性表。F作者: 李廷元单位: 中...原创 2019-10-29 22:17:10 · 2328 阅读 · 0 评论