Shirlies
宁静专注认真的程序媛~
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 21 下一页
摘要: 矩阵相乘代码如下: 1 #include <cstdio> 2 #include <cstring> 3 4 struct matrix 5 { 6 int g[10][10]; 7 }mt; 8 9 int kk,m;10 11 matrix multi(matrix a,matrix b)12 {13 matrix ans;14 15 for(int i = 0;i < 10;i ++)16 {17 for(int j = 0;j < 10;j ++)18 {19 int t = 0;20 ... 阅读全文
posted @ 2012-05-25 21:24 Shirlies 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 代码如下: 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 5 const int maxn = 3000000+100; 6 int phi[maxn]; 7 int a,b; 8 9 void phi_table(int n)10 {11 memset(phi,0,sizeof(phi));12 phi[1] = 1;13 for(int i = 2;i <= n;i ++)14 {15 if(!phi[i])16 {17 ... 阅读全文
posted @ 2012-05-23 18:00 Shirlies 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 代码如下: 1 #include <cstdio> 2 #include <cstring> 3 #include <vector> 4 using namespace std; 5 6 struct node 7 { 8 char cc[7],dd[7]; 9 }cat[1000],dog[1000];10 11 vector<int> match[1000];12 int vis[1000];13 int link[1000];14 int n,m,k;15 16 bool can(int x)17 {18 int len = match[x 阅读全文
posted @ 2012-05-23 12:49 Shirlies 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 代码如下: 1 #include <cstdio> 2 #include <cstring> 3 4 int n,m,k; 5 int g[110][110]; 6 int link[110]; 7 int a[10000],b[10000]; 8 int vis[110]; 9 10 bool can(int x)11 {12 for(int i = 1;i <= m;i ++)13 {14 if(g[x][i] && !vis[i])15 {16 vis[i] = 1;17 if(link[i... 阅读全文
posted @ 2012-05-23 12:45 Shirlies 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 晕死,一个循环害死我了,改了好长时间一直WA,搞得我莫名其妙,真是百思不得其解,现在才发现时一个while写成了if,晕死~~~代码如下: 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 using namespace std; 5 6 const double pi = acos(-1.0); 7 struct node 8 { 9 int x,y;10 }p[1100],stack[1100];11 12 int n;13 double length;14 int top;1 阅读全文
posted @ 2012-05-22 21:38 Shirlies 阅读(308) 评论(0) 推荐(0) 编辑
摘要: 判断线段相交问题,其实还以为会超时的,结果良好^_^代码如下: 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 5 struct point 6 { 7 double x,y; 8 }; 9 10 struct node11 {12 point aa,bb;13 }segment[100100];14 15 int n;16 int stack[100100];17 18 double cross_product(point &a,point &b,point & 阅读全文
posted @ 2012-05-21 15:10 Shirlies 阅读(225) 评论(0) 推荐(1) 编辑
摘要: 代码如下: 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 5 void solve(); 6 int L,sx,sy,px,py; 7 8 int main() 9 {10 while(scanf("%d",&L),L)11 {12 scanf("%d%d%d%d",&sx,&sy,&px,&py);13 14 if(py > L || px > L || py < -L || p 阅读全文
posted @ 2012-05-20 21:44 Shirlies 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 凸包代码如下: 1 #include <cstdio> 2 #include <algorithm> 3 #include <cstring> 4 #include <cmath> 5 using namespace std; 6 7 struct node 8 { 9 int x,y;10 }p[1000],stack[1000];11 int n,top;12 13 double dis(node &a,node &b)14 {15 return sqrt(1.0*(a.x - b.x) * (a.x - b.x) + 1.0 阅读全文
posted @ 2012-05-20 21:35 Shirlies 阅读(167) 评论(0) 推荐(0) 编辑
摘要: #include <cstdio>#include <cstring>#include <vector>using namespace std;vector<int> land[100];int link[100];bool vis[100];int g[110][110];bool vis2[100];int pond[100];int n,m,k;bool can(int x){ int len = land[x].size(); for(int i = 0;i < len;i ++) { int t = land[x].at(i); 阅读全文
posted @ 2012-05-13 11:24 Shirlies 阅读(299) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <cstring>#include <string>#include <vector>using namespace std;vector<int> card[100];int n;bool vis[100];int link[100];int num_pre(char a){ static string pre = "23456789TJQKA"; for(int i = 0;i < pre.size();i ++) { if(a == pre.at( 阅读全文
posted @ 2012-05-13 09:40 Shirlies 阅读(408) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 21 下一页