摘要: E - N皇后问题 HDU - 2553 之前在洛谷上做的那个通过了之后,拿来做杭电上的N皇后却超时了,百度了之后才知道要打个表,所谓打表我理解之后感觉就是先把可能的情况运行一遍,然后存在一个数组中,之后再根据所要求的数据通过之前这个数组求出 #include<iostream> //#includ 阅读全文
posted @ 2020-04-01 18:58 zj凯 阅读(176) 评论(0) 推荐(0)
摘要: A - Prime Ring Problem HDU - 1016 #include<iostream> #include<cmath> #include<cstring> using namespace std; int n; int a[100]; int vis[100]; int num; 阅读全文
posted @ 2020-03-31 17:45 zj凯 阅读(96) 评论(0) 推荐(0)
摘要: 题目描述 一个如下的 6 \times 66×6 的跳棋棋盘,有六个棋子被放置在棋盘上,使得每行、每列有且只有一个,每条对角线(包括两条主对角线的所有平行线)上至多有一个棋子。 上面的布局可以用序列 2\ 4\ 6\ 1\ 3\ 52 4 6 1 3 5 来描述,第 ii 个数字表示在第 ii 行的 阅读全文
posted @ 2020-03-28 19:21 zj凯 阅读(204) 评论(0) 推荐(0)
摘要: There is a frog staying to the left of the string s=s1s2…sn consisting of n characters (to be more precise, the frog initially stays at the cell 0). E 阅读全文
posted @ 2020-03-19 23:10 zj凯 阅读(133) 评论(0) 推荐(0)
摘要: You are given an array aa consisting of nn integers. Your task is to determine if aa has some subsequence of length at least 33 that is a palindrome. 阅读全文
posted @ 2020-03-17 12:54 zj凯 阅读(366) 评论(0) 推荐(0)
摘要: 这个题花费了我两天的时间来解决,最终找到了两个比较简单的方法 首先这个题不难看出是寻找a[i]+a[j]<0的情况,我第一开始直接用两个for循环遍历通过不了,应该是复杂度太大了 第一个方法 #include<algorithm> #include<iostream> #include<functi 阅读全文
posted @ 2020-03-17 12:08 zj凯 阅读(246) 评论(0) 推荐(0)
摘要: 这两天看了一个比较好的sort总结,所以转载了一下 阅读目录 1.sort 2.sort简介 3.sort扩展 1.sort 使用:#include <algorithm> using namespace std; 作用:排序 时间复杂度:n*lg(n) 实现原理:sort并不是简单的快速排序,它对 阅读全文
posted @ 2020-03-17 11:13 zj凯 阅读(179) 评论(0) 推荐(0)
摘要: #include <stdio.h> int a[100],n; void quicksort(int left,int right) { int i,j,temp,t; if(left>right) { return; } temp=a[left]; i=left; j=right; while( 阅读全文
posted @ 2020-02-15 12:26 zj凯 阅读(92) 评论(0) 推荐(0)
摘要: 1 #include <stdio.h> 2 struct student 3 { 4 int num; 5 float score; 6 struct student*next; 7 }; 8 int main() 9 { 10 struct student a,b,c,*head,*p; 11 阅读全文
posted @ 2020-02-08 16:14 zj凯 阅读(292) 评论(0) 推荐(0)
摘要: #include <iostream> #include<math.h> #include<iomanip> using namespace std; int main() { float i=0,a,b,c,d; float m; for(i=0;cin>>a>>b>>c>>d;i++) { m= 阅读全文
posted @ 2020-02-08 15:36 zj凯 阅读(158) 评论(0) 推荐(0)