最大生成树,只需要变一下改变值的部分就可以了。
尝试了一下运用并查集的kruskal算法,与prim相比各有利弊吧,还要根据数据特点适当选取。
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int n,m,a,b,c,par[1005],rankk[1005];
struc...
分类:
其他好文 时间:
2015-05-01 10:44:48
阅读次数:
130
题目描述
猴子吃桃问题。猴子第一天摘下若干个桃子,当即吃了一半,还不过瘾,又多吃了一个。第二天早上又将剩下的桃子吃掉一半,又多吃一个。以后每天早上都吃了前一天剩下的一半零一个。到第N天早上想再吃时,见只剩下一个桃子了。求第一天共摘多少桃子。输入
N输出
桃子总数样例输入
10
样例输出
1534解答#include
using namespace std;
int...
分类:
其他好文 时间:
2015-05-01 10:44:39
阅读次数:
218
#include
using namespace std;
int Grial(int x,int y)
{
int count = 0;
while(x!=0 || y!=0)
{
if( ((x&0x1) ^ (y&0x1)) )
count++;
x>>=1;
y>>=1;
}
return count;
}
int main()
{
cout<<Grial(...
分类:
编程语言 时间:
2015-05-01 10:42:25
阅读次数:
149
#include
#include
#include using namespace std;int main()
{
char a[10050],s[1000007];
int c;scanf("%d",&c);
while(c--)
{
scanf("%s%s",a,s);...
分类:
其他好文 时间:
2015-05-01 10:41:31
阅读次数:
149
题意:求最长回文串,模板题 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 #define MOD 100000000710 const int...
分类:
编程语言 时间:
2015-05-01 10:34:19
阅读次数:
124
原题链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1269伸展树的运用,如下: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using std::swap; 7...
分类:
其他好文 时间:
2015-05-01 10:33:12
阅读次数:
125
using System;using System.Text;using System.Windows.Forms;using System.Threading;namespace WindowsApplication1{ public partial class Form1 : Form ...
分类:
编程语言 时间:
2015-05-01 10:30:29
阅读次数:
181
NSMutableAttributedString *str
= [[NSMutableAttributedString alloc]
initWithString:@"Using
NSAttributed String"];
[str
addAttribute:NSForegroundColorAttributeName value:[UIColor
blueColor...
分类:
其他好文 时间:
2015-05-01 09:23:20
阅读次数:
125
题目描述
写一个函数,使给定的一个二维数组(3×3)转置,即行列互换。
输入
一个3x3的矩阵
输出
转置后的矩阵
样例输入
1 2 3
4 5 6
7 8 9
样例输出
1 4 7
2 5 8
3 6 9
解答
#include
using namespace std;
void zhuang...
分类:
编程语言 时间:
2015-05-01 09:23:20
阅读次数:
190
To be more specific, a Shader defines:The method to render an object. This includes using different methods depending on the graphics card of the end ...
分类:
编程语言 时间:
2015-05-01 07:00:27
阅读次数:
135