码迷,mamicode.com
首页 >  
搜索关键字:using    ( 53562个结果
C# 反转字符串
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 实现字符串的返转{ class Program { static void Main(st...
分类:Windows程序   时间:2015-08-31 14:57:20    阅读次数:176
青蛙交换(转)
http://britton.disted.camosun.bc.ca/frog_puzzle.htm #include?<iostream> using?namespace?std; int?IfSuccess(int*?p_result){ int?success?=?1; for(int?i?=?0;?i?<?3;?i?++){ if...
分类:其他好文   时间:2015-08-31 13:47:17    阅读次数:199
hdu1358 Period(kmp周期)
题目链接:点击打开链接 题意描述:给一个字符串,求这个字符串中每个前缀自身是否有周期性? 解题思路:kmp即可 代码: #include #include #define MAXN 1000010 using namespace std; void getNext(char* str,int len,int* next){ int i,j; j=next[0]=...
分类:其他好文   时间:2015-08-31 13:40:06    阅读次数:87
算法题:求指定数组中和为N的出现的所有组合(二)
#include #include using namespace std;void deal_sum(int a[],int n,int val) { int count = 1; int m = n; int *b= (int*)calloc(0,n); while(m--) { count*=2...
分类:编程语言   时间:2015-08-31 13:33:51    阅读次数:293
LeetCode:Linked List Cycle
Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 1 /** 2 * Definition for singly-linked ....
分类:其他好文   时间:2015-08-31 13:18:58    阅读次数:141
树转为二叉树
转摘:谢谢 http://blog.csdn.net/wangyangkobe/article/details/6229451 #include "stdafx.h"#include #include using namespace std;//树的节点struct TreeNode{ char e...
分类:其他好文   时间:2015-08-31 11:45:31    阅读次数:172
hdu 5424 回溯+并查集判断连通性
题意:给定一个n个点n条边的无向图,判断是否存在哈密顿路径。思路:先用并查集判断图是否连通,然后从度数最小的点开始回溯,看是否能找到一条哈密顿路径。 1 #include 2 #include 3 #include 4 #include 5 using namespace std;...
分类:其他好文   时间:2015-08-31 10:01:47    阅读次数:133
最高分是多少
题目描述:老师想知道从某某同学当中,分数最高的是多少,现在请你编程模拟老师的询问。当然,老师有时候需要更新某位同学的成绩.输入描述:输入包括多组测试数据。每组输入第一行是两个正整数N和M(0 2 #include 3 using namespace std; 4 5 int main() 6 ...
分类:其他好文   时间:2015-08-31 09:52:12    阅读次数:127
hdu1242
链接:点击打开链接 题意:r为起点,a为终点,没走一步需要花费一个单位时间,x为怪,遇到怪可以考虑打怪,打怪会花费一个单位时间,问走到终点最少花费时间为多少 代码:#include #include #include #include #include #include using namespace std; int n,m,enx,eny; int xx[]={-1,0,1,0...
分类:其他好文   时间:2015-08-31 06:32:37    阅读次数:211
hdu5422
链接:点击打开链接 题意:给出一个图,每条边都为1,使1到n走的路径为最短的同时再添加一条边,问有多少种添加的情况 代码:#include using namespace std; int main(){ //因为再添加一条边所以最短路一定为1 int n,m,a,b,sign; //因此问题变为求出添加的种数,因为最 while(cin>>n...
分类:其他好文   时间:2015-08-31 06:32:25    阅读次数:233
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!