- 博客(22)
- 收藏
- 关注
原创 N皇后
#include<bits/stdc++.h>using namespace std;const int MAX = 110;int a[MAX][MAX],ver[MAX],L[2*MAX],R[2*MAX]; ///ver表示竖线,L表示左斜线,R表示右斜线int ans = 0;void print(int n){ for(int i = 0;i<n...
2020-11-26 17:47:09
103
原创 2020 年 “联想杯”全国高校程序设计在线邀请赛暨第三届上海理工大学程序设计竞赛 C. Cheat Sheet
题目:University of Shanghai for Science and Technology starts a course calledFilm Appreciation ofBlack Albumrecently. To be the best “Blackologist” in the university, Setsuna is actively preparing for the exam.The examination of the course is open bo...
2020-06-01 11:24:07
533
转载 01背包模板
一维数组//求解将哪些物品装入背包可使价值总和最大 #include <iostream>#include<cstring>using namespace std;const int nmax=1000; int v[nmax];//v[i]表示第i个物品的价值value int w[nmax];//w[i]表示第i个物品的重量weight int ...
2019-11-14 20:28:51
144
原创 hdu 1032 The 3n + 1 problem
The 3n + 1 problem注意很坑!!!i 和 j 的大小Problem DescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this p...
2019-05-22 21:41:27
217
原创 hdu 1003 Max Sum
Max SumProblem DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + ...
2019-05-09 22:47:07
148
转载 汉诺塔问题
汉诺塔问题链接:https://www.jisuanke.com/course/2291/182230问题分析:参考博客:http://www.cnblogs.com/xxNote/p/3965739.html先把n-1个盘子从A移动到B,剩下最大的那个盘子在A(这时所移动的次数为f (n-1) ) 再将最大的那个盘子移到C盘,(这时所移动的次数为 f (n-1)...
2019-05-01 21:46:45
508
原创 hdu 2058 The sum problem
Problem DescriptionGiven a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequences that the sum of the sub-sequence is M.InputInput contains multiple test cases. each ...
2019-04-21 23:42:32
170
原创 hdu 2057 A + B Again
A + B AgainProblem DescriptionThere must be many A + B problems in our HDOJ , now a new one is coming.Give you two hexadecimal integers , your task is to calculate the sum of them,and print it i...
2019-04-21 22:13:45
141
原创 2019中山大学程序设计竞赛(重现赛) Coding Problem
Coding ProblemProblem DescriptionHere is the logic.I am the brother of mata Chuang.Mata chuang is the brother of cxk.So what am I?Am I the grand-brother of cxk?Or am I in a position that same bro...
2019-04-20 21:05:03
272
原创 hdu 2054 A == B ?
A == B ?Problem DescriptionGive you two numbers A and B, if A is equal to B, you should print "YES", or print "NO".Inputeach test case contains two numbers A and B.Outputfor eac...
2019-04-18 22:54:58
222
原创 hdu 2055 An easy problem
An easy problemProblem Descriptionwe define f(A) = 1, f(a) = -1, f(B) = 2, f(b) = -2, ... f(Z) = 26, f(z) = -26;Give you a letter x and a number y , you should output the result of y+f(x)Inpu...
2019-04-16 21:51:03
123
原创 hdu 2030 汉字统计
汉字统计Problem Description统计给定文本文件中汉字的个数。Input输入文件首先包含一个整数n,表示测试实例的个数,然后是n段文本。Output对于每一段文本,输出其中的汉字的个数,每个测试实例的输出占一行。[Hint:]从汉字机内码的特点考虑~Sample Input2WaHaHa! WaHaHa! 今年过节不说话要说只说普通...
2019-04-09 22:50:28
343
原创 hdu 2023 求平均成绩
求平均成绩问题描述假设一个班有n个(n <= 50)个学生,每人考m个(m <= 5)门课,求每个学生的平均成绩和每门课的平均成绩,并输出各科成绩均大于等于平均成绩的学生数量。输入输入数据有多个测试实例,每个测试实例的第一行包括两个整数Ñ和米,分别表示学生数和课程数然后是Ñ行数据,每行包括米个整数(即:考试分数)。 。输出对于每个测试实例...
2019-03-18 23:06:39
476
原创 Not so Mobile UVA 839
输入一个树状天平,根据力矩相等原则判断是否平衡。如图6-5所示,所谓力矩相等,就是WlDl=WrDr,其中Wl和Wr分别为左右两边砝码的重量,D为距离。采用递归(先序)方式输入:每个天平的格式为Wl,Dl,Wr,Dr,当Wl或Wr为0时,表示该“砝码”实际是一个子天平,接下来会描述这个子天平。当Wl=Wr=0时,会先描述左子天平,然后是右子天平。样例输入:10 2 0 ...
2019-03-14 00:01:17
194
原创 hdu 2001 计算两点间的距离
计算两点间的距离Problem Description输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。 Input输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x2,y2,数据之间用空格隔开。 Output对于每组输入数据,输出一行,结果保留两位小数。 Sample Input0 0 0 10 ...
2018-12-27 11:25:43
232
原创 hdu 2032 杨辉三角
杨辉三角Problem Description还记得中学时候学过的杨辉三角吗?具体的定义这里不再描述,你可以参考以下的图形:11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 1 Input输入数据包含多个测试实例,每个测试实例的输入只包含一个正整数n(1<=n<=30),表示将要输出的杨辉三角的层数。 Outp...
2018-12-23 15:32:49
187
原创 hdu 2094 产生冠军
产生冠军Problem Description有一群人,打乒乓球比赛,两两捉对撕杀,每两个人之间最多打一场比赛。球赛的规则如下:如果A打败了B,B又打败了C,而A与C之间没有进行过比赛,那么就认定,A一定能打败C。如果A打败了B,B又打败了C,而且,C又打败了A,那么A、B、C三者都不可能成为冠军。根据这个规则,无需循环较量,或许就能确定冠军。你的任务就是面对一群比赛选手,在经过...
2018-12-12 22:57:42
140
原创 hdu 2018 母牛的故事
母牛的故事问题描述有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第Ñ年的时候,共有多少头母牛? 输入输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0 <n <55),n的含义如题目中描述.n = 0表示输入数据的结束,不做处理。 输出对于每个测试实例,输出在第ň年的时候...
2018-12-09 17:54:48
133
原创 noi 06:循环数
全局题号:1953总时间限制:1000ms内存限制:65536kB描述若一个n位的数字串满足下述条件,则称其是循环数(cyclic):将这个数字串视为整数(可能带有前导0),并用任意一个 1 到 n 之间(包含1和n)的整数去乘它时, 会得到一个将原数字串首尾相接后,再在某处断开而得到的新数字串所对应的整数。例如,数字 142857 是循环数,因为:142857 *1 ...
2018-12-09 17:53:10
1550
原创 hdu 1039 I Think I Need a Houseboat
I Think I Need a HouseboatProblem DescriptionFred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the stat...
2018-12-02 22:39:52
171
原创 hdu 1039 Easier Done Than Said?
Easier Done Than Said?Problem DescriptionPassword security is a tricky thing. Users prefer simple passwords that are easy to remember (like buddy), but such passwords are often insecure. Some sites ...
2018-12-02 21:33:25
162
原创 hdu 2007 平方和与立方和
平方和与立方和Problem Description给定一段连续的整数,求出他们中所有偶数的平方和以及所有奇数的立方和。 Input输入数据包含多组测试实例,每组测试实例包含一行,由两个整数m和n组成。 Output对于每组输入数据,输出一行,应包括两个整数x和y,分别表示该段连续的整数中所有偶数的平方和以及所有奇数的立方和。你可以认为32位整数足以保...
2018-11-30 20:30:09
125
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人