码迷,mamicode.com
首页 >  
搜索关键字:c++ memset    ( 3691个结果
hdu 2830 Matrix Swapping II(hdu1505的加强版)
#include #include #include #define N 1005 using namespace std; const int INF=1<<30; char mat[N][N]; int a[N][N]; int L[N],R[N]; int main() { int m,n; memset(a,0,sizeof(0)); while(scanf("...
分类:移动开发   时间:2015-05-12 17:16:55    阅读次数:168
HDU_1233《还是畅通工程》
#include #include #include #include using namespace std; const int maxn = 1000 + 5; vector G[maxn]; int p[maxn]; void init(int N) { memset(p, 0, sizeof(p)); for(int i = 1; i <= N; i++) ...
分类:其他好文   时间:2015-05-11 22:10:30    阅读次数:105
HDU_1863《畅通工程》
#include #include #include #include using namespace std; const int maxn = 1000 + 5; vector G[maxn]; int p[maxn]; void init(int N) { memset(p, 0, sizeof(p)); for(int i = 1; i <= N; i++) ...
分类:其他好文   时间:2015-05-11 22:10:23    阅读次数:91
HDU ACM 5211 Mutiple
分析:筛法的思想,首先记录每个值的坐标,在使用筛法。 #include using namespace std; int a[10005]; int f[10005]; int main() { int i,n,j,mx,ans,tmp; ios::sync_with_stdio(false); while(cin>>n) { mx=-1; memset(f,-1,size...
分类:其他好文   时间:2015-05-11 14:49:13    阅读次数:145
leetcode Valid Sudoku
代码: 1 #include 2 #include 3 4 using namespace std; 5 6 int length = 9; 7 8 bool isValidSudoku(vector>& board) 9 {10 int flag[9];11 memset(...
分类:其他好文   时间:2015-05-11 10:41:20    阅读次数:115
hdu 2512 一卡通大冒险
简单dp dp[i][j]表示i长卡放到j本书里 #include #include #define maxn 2000+5 using namespace std; int dp[maxn][maxn]; void ready() { memset(dp,0,sizeof(dp)); dp[1][1]=1;dp[2][1]=dp[2][2]=1; for(int i=2;i<=2000...
分类:其他好文   时间:2015-05-10 15:46:57    阅读次数:111
poj 2897 Dramatic Multiplications 模拟
//poj 2897 //sep9 #include using namespace std; int ans[128],ansp; int main() { int cases,n,k; scanf("%d",&cases); while(cases--){ memset(ans,0,sizeof(ans)); ansp=0; scanf("%d%d",&n,&k); in...
分类:其他好文   时间:2015-05-10 13:00:38    阅读次数:117
密码验证合格程序
#include #include #include using namespace std; //计算字符串中字符的种类 int calTypeKinds(string &str) { int count[4]; memset(count , 0 , sizeof(int)*4); for(size_t i = 0; i < str.length(); ++i) { if(s...
分类:其他好文   时间:2015-05-10 11:29:38    阅读次数:221
Eratosthenes,筛法求素数
//筛法求区间[0,n]的所有素数,v为素数表 //v[i]==0,i为素数void f(int n) { int m=sqrt(n+0.5); memset(v,0,sizeof(v)); for (int i=2;i<=m;i++) if (!v[i]) for ...
分类:其他好文   时间:2015-05-10 11:19:57    阅读次数:115
12个有趣面试题(C语言)
1.gets()函数 #include int main(int argc, char *argv[]) { char buff[10]; memset(buff, 0, sizeof(buff)); gets(buff); printf("\n The buffer entered is [%s]\n",buff); return 0; }答:上面代码里的问题在于函数gets...
分类:编程语言   时间:2015-05-10 09:52:12    阅读次数:132
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!