***用一个数组表示两个堆栈,最大限度的利用空间0123若果像右图中从中间分成两部分,则可能存在其中一个堆栈满了,而另一个堆栈还有空的,为你最大限度的利用空间,需要两边像中间长,知道指针碰头表示堆栈已满#includeusing namespace std;#define Maxsize 100cl...
分类:
编程语言 时间:
2015-04-09 21:50:51
阅读次数:
162
#includeusing namespace std;int main(){ char s1[100],s2[100]; int res[100]; while(cin>>s1>>s2){ memset(res,0,sizeof(res)); int ...
分类:
其他好文 时间:
2015-04-09 21:47:05
阅读次数:
133
题目大意: 就是说,对于一个起点,使得从这个起点开始,每次间隔相同的格子后,所经过的地方都是‘*’解题思路: 直接暴力,枚举起点+枚举公差代码: 1 # include 2 # include 3 4 using namespace std; 5 6 # de...
分类:
其他好文 时间:
2015-04-09 21:35:27
阅读次数:
140
题目描述:两个人玩游戏取石子,规定取走最后一个石子的人输,取子规则是:如果当前剩余n个石子,则这一步只能取走x个石子,满足n % x = 0.分析:打了个表发现规律很简单,不过不会证明啊! 1 #include 2 using namespace std; 3 4 int main () 5 {.....
分类:
其他好文 时间:
2015-04-09 21:31:33
阅读次数:
106
原题地址主要是介绍了两个定理:1. 二分图最大匹配数 = 二分图最小点覆盖数2. 二分图最小点覆盖数 = 二分图顶点数 - 二分图最小点覆盖数注意,都是二分图代码:(匈牙利算法) 1 #include 2 #include 3 4 using namespace std; 5 6 #def...
分类:
其他好文 时间:
2015-04-09 21:24:43
阅读次数:
130
水题一个,发一发我美美的代码。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 9; 7 char num[N]; 8 9 int standard( char ch )10 {11 ...
分类:
其他好文 时间:
2015-04-09 21:17:13
阅读次数:
109
#include
using namespace std;
class Base
{
int x;
public:
Base(int a)
{
x = a;
cout<<"father constructing "<<x<<endl;
}
~Base()
{
cout<<"father destruct...
分类:
编程语言 时间:
2015-04-09 19:58:44
阅读次数:
183
题意:
跟经典的nim除了胜利条件不一样(nim当游戏者面对空的决策集判负,anti-SG当游戏者面对空的决策集判负),其他都一样。
分析:
设全局状态为s,单个游戏为t。先手必胜条件:(g(s)!=0&&Existg(t)>1)||(g(s)==0&&Anyg(t)
代码:
//poj 3480
//sep9
#include
using namespace std;
int ma...
分类:
其他好文 时间:
2015-04-09 19:51:38
阅读次数:
213
1)宏定义实现:
#define MySizeof(Value) (char*)(&Value + 1) - (char*)&Value
(char*)&Value返回Value的地址的第一个字节, (char*)(&Value + 1)返回的是Value的地址的下一个地址的第一个字节
#include
using namespace std;
#define my_sizeo...
分类:
其他好文 时间:
2015-04-09 19:49:02
阅读次数:
104
//两个人,如果n为m+1的倍数,那么第一个人无论取什么数,第二个人只需要使得两个人取得数等于m+1就行,所以第二个人
//一定会赢
//如果n不是m+1的倍数,那么第一个人只需要取n%(m+1)就行,然后后面的情况和上面一样
#include
#include
#include
using namespace std ;
int main()
{
int n , m ;...
分类:
其他好文 时间:
2015-04-09 19:48:17
阅读次数:
163