#include
#include
#include
#include
using namespace std;
int pow(int x, int n)
{
int result = 1;
while (n > 0)
{
if (n % 2==1)
result *= x;...
分类:
其他好文 时间:
2014-06-03 05:08:33
阅读次数:
399
很简单的bellmanford题目,这里比较详细:http://blog.csdn.net/lyy289065406/article/details/6645790
直接代码
#include
#include
#include
#include
#include
#include
using namespace std;
const int SIZE=11111;
const i...
分类:
其他好文 时间:
2014-06-03 04:10:45
阅读次数:
182
#include
__global__ void childKernel(int i)
{
int tid = blockIdx.x*blockDim.x+threadIdx.x;
printf("parent:%d,child:%d\n",i,tid);
for(int j=i;j<i+10;j++)
{
printf(",%d",j);
}
printf("\n");...
分类:
其他好文 时间:
2014-06-03 03:58:15
阅读次数:
206
1.判断一个数是都是回文数
#include
int main(void)
{
int a[100] = {0};
int n;
printf("input n:");
scanf("%d", &n);
int i, k, j;
k = 0;
j = 0;
while(n != 0)
{
a[k++] = n % 10;
n = n / 10;
j+...
分类:
编程语言 时间:
2014-06-03 03:26:18
阅读次数:
255
An iterative way of writing merge sort:
#include
using namespace std;
void merge(int A[], int l, int r, int e, int B[]) {
int i = l, j = r, k = l;
while (i<r && j A[j]) B[k++] =...
分类:
其他好文 时间:
2014-06-03 02:33:24
阅读次数:
215
三分查找:
#include
#define M 10
int main(void)
{
int front, near, mid1, mid2;
int n;
int found;
int a[M] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
front = 0;
near = M - 1;
found = 0;
printf("input n:");...
分类:
编程语言 时间:
2014-06-03 01:38:47
阅读次数:
399
http://poj.org/problem?id=2891这道题的题意是:给你多个模性方程组:m mod ai=ri 求最小的m;中国剩余定理 1
#include 2 #include 3 #include 4 #define ll long long 5 using namespace ...
分类:
其他好文 时间:
2014-05-31 19:06:39
阅读次数:
191
函数原型:string& replace (size_t pos, size_t len,
const string& str);具体请查阅C++开发文档。只贴示例代码。示例代码:// replacing in a string#include
#include int ...
分类:
其他好文 时间:
2014-05-31 18:35:32
阅读次数:
202
无根树同构有两种方法,一种是确定其中一棵树,另一棵树枚举根节点。一种是,利用拓扑排序,先确定其中一棵树。另一棵树,若拓扑后剩两个节点,则枚举这两个节点为根结点,否则,只需做一次。注意,无根树节点入度应为1。
1 #include 2 #include 3 using namespace std;.....
分类:
其他好文 时间:
2014-05-31 18:33:41
阅读次数:
263
有根树同构。参考论文《hash在。。。。》 1 #include 2 #include 3
#include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 const
int leaf_hash=2099;...
分类:
其他好文 时间:
2014-05-31 18:21:24
阅读次数:
187