#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
对于每个输入的站点求出所有点到这个站点的最短路。用anss数组存下来,然后就可以用anss数组求出答案了。题目分析清楚了 还是比较水的,折腾了一早上。。#include#include#include#include#include#includeusing namespace std;struct...
分类:
其他好文 时间:
2015-05-01 10:31:37
阅读次数:
135
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
题目描述
写一个函数,使给定的一个二维数组(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
//这是递归#includeusing namespace std;int f(int n) { if(n==0 || n==1) return 1; return f(n-2) + f(n/2);}int main() { int n; cin >> n; cout ...
分类:
其他好文 时间:
2015-05-01 01:50:22
阅读次数:
117
题意:一个n*m的迷宫,从起点到终点,问是否恰能在t个单位时间到达;思路:dfs遍历各种可能情况,奇偶剪枝;#include#include#include#include#includeusing namespace std;char mm[55][55];int vis[55][55];int ...
分类:
其他好文 时间:
2015-05-01 00:28:02
阅读次数:
220
这一题,也是简单的二分搜索,求解放置的牛之间的距离尽可能远,也就是最大化最小值。
主要的一步就是将第i头牛放在了x[j]的位置中,第i + 1
头牛就要放在满足x[j] + d ,k的最小值。
下面是AC的代码:
#include
#include
using namespace std;
int N, M;
int X[100005];
bool C(int x)
{
int ...
分类:
其他好文 时间:
2015-04-30 23:19:52
阅读次数:
378
最小生成树算法。
#include
#include
#include
#include
#include
#include
using namespace std;
const int INF = 1000000000;
int cost[105][105];
int mincost[105];
bool used[105];
int n,a;
int prim() {
for(int...
分类:
Web程序 时间:
2015-04-30 21:57:26
阅读次数:
143