- 博客(90)
- 收藏
- 关注
转载 poj 1753 翻转棋子
题目大意:http://poj.org/problem?id=1753翻转棋子,每个棋子只能翻转一次,因为翻转两次的效果是没翻,翻转三次的效果和翻转一次一样。。。代码:#include <iostream>using namespace std;int arr[4][4] = {0};int mv[5][2] = {{0,0},...
2017-12-21 14:29:00
327
转载 poj 1321 棋盘问题
题目大意:http://poj.org/problem?id=1321Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个...
2017-12-21 14:25:00
686
转载 CodeVs 1295 N皇后问题
题目大意:http://codevs.cn/problem/1295/代码:#include <iostream>#include <cmath>using namespace std;int n;int arr[15] = {0};int count = 0;bool canPos(int x){...
2017-12-21 13:58:00
226
转载 POJ 3349 Snowflake Snow Snowflakes
poj 3349雪花是否相同#include<iostream>#include <algorithm>#include <stdio.h>#include <cstdio>using namespace std;#define size 100010int arr[size][6];i...
2017-12-13 17:02:00
171
转载 链表API
#include <iostream>#include <stdio.h>using namespace std;#define size 1000struct node{ int num; node *next; node *pre;};node NodeListPool[size...
2017-12-13 17:00:00
172
转载 Hash API
#include <iostream>using namespace std;#define size 100struct node{ int val; node *pre; node *next;};int index = 0;node HashTable[size];node HashPoo...
2017-12-13 16:53:00
139
转载 CodeVS 1220 数字三角形
题目大意(经典的动态规划题型)http://codevs.cn/problem/1220/#include <iostream>using namespace std;int n;int arr[110][110];int main(){ cin >> n; for(int i = 1; i <...
2017-11-27 16:39:00
187
转载 CodeVS 1045 回文数
题目大意:http://codevs.cn/problem/1045/代码:#include <iostream>#include <cstring>using namespace std;int n,m;char ch[500];int arr[500];void print(){ for(in...
2017-10-19 14:46:00
157
转载 CodeVS 1058 合唱队形(DP--最长子序列问题)
题目大意:http://codevs.cn/problem/1058/求每一个点的之前的最长上升子序列和每一个点的之后的最长下降子序列。之前报错,因为需要将每一个dp的值赋值为1.代码:#include <iostream>#include <cstring>using namespace std;int arr[100...
2017-10-10 10:05:00
242
转载 CodeVS 1018 单词接龙(DFS)
题目大意:http://codevs.cn/problem/1018/注意每个单词可以用两次,因为一个单词用一遍只取到了头,还要再用一遍单词取到尾。代码:#include <iostream>using namespace std;int n;bool visit[100] = {false};char ch;int res ...
2017-10-09 16:13:00
189
转载 CodeVS 1084 乒乓球
题目大意:http://codevs.cn/problem/1084/本道题目有两个坑:1. 比赛双方的比分的差必须大于2,(按照实际的规则弄得,题目中没有说)2.读入字符串的时候,E标志着字符串的结尾,但是也要读进字符串。例如:WWWWWWWWWWWE(11个W,一个E):程序的输出结果应该是:11:00:0而不应该只是:11:0...
2017-09-30 17:10:00
229
转载 android开发之屏幕旋转
在Android开发的过程中,可以通过在menifest.xml文件中添加 android:screenOrientation = " " 来设置屏幕的旋转。在Android官方的文档中,对android:screenOrientation的说明如下:具体为:landscape:限制界面为横屏,旋转屏幕也不会改变当前状态。portrait:限...
2017-09-30 14:46:00
178
转载 Android开发之新建项目报错的问题
通过android studio新建一个空项目。在新建完项目之后,gradle编译会报错。发生问题的原因是build.gradle(Project:TopDialog)中:allprojects { repositories { jcenter() }}jecnter()需要下载junit的依赖,但是被墙了(网上博客如是说),所以关于junit的部分...
2017-09-29 10:28:00
400
转载 Android 开发获取用户权限
Android某些功能的使用需要获得权限,对于一些常用权限,可以再Androidmanifest.xml中添加。添加方式如下: <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permi...
2017-09-27 20:05:00
536
转载 CodeVS 3116 高精度练习之加法
题目大意:http://codevs.cn/problem/3116/题解:#include <iostream>#include <string>#include <cstring>#include <sstream>#define trans(x)(x-'0')using namespace st...
2017-09-27 20:03:00
142
转载 CodeVS 3115 高精度练习之减法
题目大意:http://codevs.cn/problem/3115/题解:#include <iostream>#include <algorithm>#include <cmath>using namespace std;int ans[501] = {0};int sub(string a, ...
2017-09-27 20:02:00
159
转载 CodeVS 3117 高精度之乘法
题目大意:给定两个不超过500位的数,计算他们的乘积http://codevs.cn/problem/3117/题解:#include <iostream>#include <cstdio>#include <cstring>using namespace std;char a[501];char ...
2017-09-27 20:00:00
125
转载 Android开发之各种权限详解
android.permission.EXPAND_STATUS_BAR允许一个程序扩展收缩在状态栏,android开发网提示应该是一个类似Windows Mobile中的托盘程序android.permission.FACTORY_TEST作为一个工厂测试程序,运行在root用户android.permission.FLASHLIGHT访问闪光灯,android开发网提示HTC...
2017-09-22 17:18:00
185
转载 CodeVS 1031 质数环(DP)
题目大意:http://codevs.cn/problem/1031/#include <iostream>#include <cmath>#include <algorithm>#include <string>using namespace std;int arr[17] = {0};b...
2017-09-22 16:41:00
147
转载 CodeVs 1017 乘积最大(DP)
题目大意:http://codevs.cn/problem/1017/题解:#include <iostream>using namespace std;char ch[45];int n,k;long long int arr[45][7];long long int dp[45][7];int main()...
2017-09-20 21:19:00
136
转载 CodeVS 1294 全排列(dfs)
题目:http://codevs.cn/problem/1294/代码(用cout 会超时!!!):#include <iostream>#include<cstdio>using namespace std;int n;bool visited[15] = {false};int res[15] = {0};...
2017-09-07 16:29:00
143
转载 CodeVS 1048 石子归并(区间DP)
题目大意:http://codevs.cn/problem/1048/基本思路:dp[i][j]代表把i到j堆的堆在一起所需要的最小花费。dp[i][j] = min(dp[i][j],dp[i][k]+dp[k+1][j]+wi+....+wj)。代码:#include <iostream>#include <cstring...
2017-09-06 22:11:00
151
转载 CodeVS 1214 线段覆盖(DP)
题目大意:http://codevs.cn/problem/1214/代码:#include <iostream>#include <algorithm>#include <cstring>using namespace std;struct type{ int x,y;};int dp...
2017-09-06 22:05:00
172
转载 CodeVS 1044 拦截导弹(DP)
题目大意:http://codevs.cn/problem/1044/第一问题就是求序列的最长递减数列的长度,第二问就是求数列的最长递增序列的长度。代码:#include <iostream>using namespace std;int arr[30] = {0};int dp[30] = {0};int mp[30] = {...
2017-09-06 16:46:00
130
转载 CodeVS 3027 线段覆盖2(DP)
题目大意:http://codevs.cn/problem/3027/源码:#include <iostream>using namespace std;struct { int x,y,val;}tmp[1050];int dp[1050] = {0};int main(){ int n;...
2017-09-06 14:56:00
148
转载 CodeVS 1576 最长严格上升子序列 (DP)
题目大意:http://codevs.cn/problem/1576/代码:#include <iostream>using namespace std;int arr[5100] = {0};int dp[5100] = {0};int main(){ int n,ans = 0;; cin &...
2017-09-06 14:17:00
131
转载 CodeVS 1014 装箱问题(DP)
题目大意:http://codevs.cn/problem/1014/源码:#include <iostream>#include <cmath>#include <cstdio>#include <algorithm>#include <cstring>using namespace s...
2017-09-04 15:18:00
144
转载 CodeVs 1059 汽车装油
题目大意:http://codevs.cn/problem/1059/#include <iostream>#include <cstdio>#include <algorithm>using namespace std;int a[1050] = {0};int b[1050] = {0};int...
2017-08-29 15:24:00
165
转载 CodeVS 1010 过河卒 (DFS)
题目大意:http://codevs.cn/problem/1010/代码:#include <iostream>using namespace std;int sx,sy;int mx,my;int ex,ey;int arr[100][100] = {0};int mv[8][2] = {{-1,2},{-2,1},{...
2017-08-25 08:47:00
194
转载 CodeVS 1009 产生数
题目大意:http://codevs.cn/problem/1009/代码:#include <iostream>using namespace std;string n;int k,a,b;int arr[10][10] = {0};int main(){ cin >> n >> k...
2017-08-25 08:45:00
125
转载 CodeVS 1008 选数(DFS)
题目大意:http://codevs.cn/problem/1008/解题:#include <iostream>#include <cmath>using namespace std;int n ,k ;int arr[21];int res;bool isPrime(int a){ for(...
2017-08-25 08:42:00
112
转载 html特殊符号对照表
摘自博客:http://www.cnblogs.com/knowledgesea/archive/2013/07/24/3210703.html转载于:https://www.cnblogs.com/zyqBlog/p/6250507.html
2017-01-04 22:42:00
146
转载 codevs 3115 高精度练习--减法
题目大意:给定两个数a、b , 算出a-b;(a和b的位数各不超过500位)思路:模拟减法:代码:#include <iostream>#include <algorithm>#include <cmath>using namespace std;int ans[501] = {0};...
2016-12-25 14:37:00
154
转载 leetcode 240. Search a 2D Matrix II
思路:从左下或者右上开始进行搜索,因为比如从左下开始搜索,若目标数大于此时的数,接下来只能向右搜,若小于,接着只能向上搜。若是从左上开始进行搜索,若目标数大于此时的数,会有两个方向可以走。 public class Solution { public boolean searchMatrix(int[][] matrix, int target) { ...
2016-11-29 18:19:00
102
转载 leetcode 100. Same Tree
题目大意:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value....
2016-11-29 17:33:00
106
转载 leeetcode 112.Path Sum
递归实现: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } *...
2016-10-29 16:10:00
121
转载 leetcode 445. Add Two Numbers II
题目大意:给定两个数,以两个链表的形式给出,算出他们的和,最后返回一个新链表。 解题思路:把给定的两个链表逆序,求和,在把求出的和即为所求的链表。 /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNod...
2016-10-29 15:13:00
165
转载 leetcode 38. Count and Say
题目大意: 第一个数是1,第二个数值11(1个1),第三个数值21(2个1),给定第几个数,输出相应的字符串。 思路: 起初的想法是递归,写着发现,就这么一直写就行,挺简单的。 public class Solution { public String countAndSay(int n) { if(...
2016-10-23 21:02:00
113
转载 leetcode 20. Valid Parentheses
栈的相关操作。 public class Solution { public boolean isValid(String s) { if(s == "") return true; Stack<Character> st = new Stack<Char...
2016-10-23 14:40:00
75
转载 leetcode 26 Remove Duplicates from Sorted Array
题目大意: 数组经过排序,删除数组中的元素,使数组中所有元素只出现一次,返回新数组的长度。不允许分配新的数组空间。 解法一(没看到题目中的数组已经排好序了。。。): public class Solution { public int removeDuplicates(int[] nums) { boole...
2016-10-23 13:56:00
63
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人