码迷,mamicode.com
首页 >  
搜索关键字:using    ( 53562个结果
构造函数复制构造函数经典问题
#include using namespace std; class A { public: A(int x=0) { a=x; cout<<"A Constructor"<<endl; } A(A&t) { cout<<"A COPY"<<endl; } ~A() { cout<<"A Destructor"<<endl; } void display()...
分类:其他好文   时间:2015-04-27 21:58:39    阅读次数:177
hdu 1022 Train Problem I
栈的应用,一定要注意把栈清空啊,最近刚开始学数据结构,代码有点水,大家不要见怪 #include #include using namespace std; int main() { int n; string in,out; stackroot; while(cin>>n>>in>>out) { while(root.size()) root.pop(); string re...
分类:其他好文   时间:2015-04-27 21:58:30    阅读次数:202
C++智能指针模板类复习
//C++智能指针模板类复习 #include #include using namespace std; //智能指针用于确保程序不存在内存和资源泄漏且是异常安全的。 //C++98中提供了auto_ptr,C++11摒弃了auto_ptr,并提出了unique_ptr 、shared_ptr、weak_ptr void show1() {     int* p = ne...
分类:编程语言   时间:2015-04-27 21:57:40    阅读次数:247
poj 3076 Sudoku dlx解数独
16*16的数独,类似poj 3074. //poj 3076 //sep9 #include #include #define INT_MAX 2147483647 using namespace std; const int col_num=16*16*4; const int row_num=16*16*16+10; const int head=0; const int MAX...
分类:其他好文   时间:2015-04-27 21:56:04    阅读次数:216
hdu 1870 愚人节的礼物
其实根本不需要用栈,因为这题不会出现盒子打不开的情况 #include #include #include #define maxn 1000+5 using namespace std; stackmapp; int main() { char ans[maxn]; while(cin>>ans) { int sum=0; while(mapp.size()) mapp.pop(...
分类:其他好文   时间:2015-04-27 21:55:57    阅读次数:189
HDU 3555 Bomb(数位DP)
题意: 寻找0  到 n 中含有49的数字的个数 #include #include #include #include #include #include #include #include #include using namespace std; const int MAXN = 50 + 10; long long dp[MAXN][3]; // dp[i][0] 长...
分类:其他好文   时间:2015-04-27 21:55:43    阅读次数:183
Codeforces Round #153 (Div. 1)APoints on Line
#include #include #include using namespace std ; const int maxn  = 100010 ; int a[maxn] ; int bit(int l , int r ,int num) {     while(l     {         int mid = (l + r) >> 1;         if(a[m...
分类:其他好文   时间:2015-04-27 21:54:50    阅读次数:180
HDU ACM 1043 Eight->广度优先搜索(BFS)+康托展开(全排列hash)实践
分析:经典的八数码问题,参考别人的代码写的,逆向广搜,把结果保存起来,之后在使用。 #include #include using namespace std; #define STATE_COUNT 363000 //因为9!=362880 int fact[]={1,1,2,6,24,120,720,5040,40320,362880}; //0到9的阶乘,用来计算hash值 cha...
分类:其他好文   时间:2015-04-27 21:54:28    阅读次数:175
Codeforces Round #153 (Div. 1)BPlaying with Permutations
//可以看出操作1和操作2是一对互逆操作 //即是一次操作1和一次操作2执行后,排列不变 //如果一种操作连续做i次能得到s //如果i刚好等于k,puts("YES") //如果不等,看剩下的k-i次操作能不能用一次操作1和一次操作2做完 #include #include #include using namespace std ; const int maxn  = 110...
分类:其他好文   时间:2015-04-27 21:53:32    阅读次数:108
poj 3435 检测数独状态是否合法
题意: 给一个数独的状态,判断它是否合法。 分析: 水,直接判断。 代码: //poj 3435 //sep9 #include using namespace std; const int maxN=10; const int MAX=maxN*maxN+10; int a[MAX][MAX]; int col_check[MAX][MAX]; int row_check[MAX][...
分类:其他好文   时间:2015-04-27 21:48:38    阅读次数:135
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!