上一页 1 ··· 40 41 42 43 44 45 46 47 48 ··· 50 下一页
摘要: 1 #include <iostream> 2 #include <algorithm> 3 4 using namespace std; 5 6 int cmp(const void *a,const void *b) 7 { 8 return *(int*)a-*(int*)b; 9 }10 11 int cn(int x)12 {13 int c=0;14 for(;x;x=x>>1)15 {16 if(x&1)17 c++;18 }19 return c;20 }21 22 int a[110];23 int b... 阅读全文
posted @ 2013-04-11 12:03 码代码的猿猿 阅读(161) 评论(0) 推荐(0) 编辑
摘要: MatrixTime Limit:2000MSMemory Limit:30000KTotal Submissions:3096Accepted:1612DescriptionGiven an n*n matrix A, whose entries Ai,j are integer numbers ( 0 <= i < n, 0 <= j < n ). An operation SHIFT at row i ( 0 <= i < n ) will move the integers in the row one position ri... 阅读全文
posted @ 2013-04-11 12:02 码代码的猿猿 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 教课书一样的代码,一遍AC:Fire NetTime Limit : 2000/1000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 15Accepted Submission(s) : 6Problem DescriptionSuppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each represen 阅读全文
posted @ 2013-04-11 11:59 码代码的猿猿 阅读(336) 评论(1) 推荐(0) 编辑
摘要: 非常经典的搜索题,很多剪枝技巧在里面!! 4 #include <iostream> 5 #include <algorithm> 6 #include <string.h> 7 8 using namespace std; 9 10 int cmp(const void *a ,const void *b)11 {12 return *(int*)b-*(int*)a;13 }14 15 int a[70];16 int n;17 int vis[70];18 int sum;19 20 int ko(int unused,int left, int ta 阅读全文
posted @ 2013-04-11 11:57 码代码的猿猿 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 3 using namespace std; 4 5 int n,k; 6 char m[9][9]; 7 int a[9]; 8 9 void dfs(int cur,int k,int& tot)10 {11 if(k<0) return;12 if(cur==n)13 {14 if(k==0)15 tot++;16 return ;17 }18 for(int i=0;i<n;i++)19 {20 if(m[cu... 阅读全文
posted @ 2013-04-11 11:54 码代码的猿猿 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 找规律的: 1 #include <iostream> 2 #include <cmath> 3 4 using namespace std; 5 6 int main() 7 { 8 int a,b; 9 while(cin>>a>>b)10 {11 b=b%4;//最多就4种情况12 a=a%10;13 switch(b)14 {15 case 1:16 cout<<a%10; break;17 case 2:18 cout<<a*a%10; break;19... 阅读全文
posted @ 2013-04-11 11:53 码代码的猿猿 阅读(184) 评论(0) 推荐(0) 编辑
摘要: Problem Description猜数字游戏是gameboy最喜欢的游戏之一。游戏的规则是这样的:计算机随机产生一个四位数,然后玩家猜这个四位数是什么。每猜一个数,计算机都会告诉玩家猜对几个数字,其中有几个数字在正确的位置上。比如计算机随机产生的数字为1122。如果玩家猜1234,因为1,2这两个数字同时存在于这两个数中,而且1在这两个数中的位置是相同的,所以计算机会告诉玩家猜对了2个数字,其中一个在正确的位置。如果玩家猜1111,那么计算机会告诉他猜对2个数字,有2个在正确的位置。现在给你一段gameboy与计算机的对话过程,你的任务是根据这段对话确定这个四位数是什么。Input输入数据 阅读全文
posted @ 2013-04-11 11:51 码代码的猿猿 阅读(403) 评论(0) 推荐(0) 编辑
摘要: 最基本的DFSLake CountingTime Limit : 2000/1000ms (Java/Other)Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 10Accepted Submission(s) : 3Problem DescriptionDue to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 & 阅读全文
posted @ 2013-04-11 11:50 码代码的猿猿 阅读(297) 评论(0) 推荐(0) 编辑
摘要: Prime PathTime Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 7 Accepted Submission(s) : 3Problem DescriptionThe ministers of the cabinet were quit... 阅读全文
posted @ 2013-04-11 06:45 码代码的猿猿 阅读(165) 评论(0) 推荐(0) 编辑
摘要: c++ stack,queue,vector用法分别包含在文件,,定义:stack s;queue q;vector v;stack的方法:push()的向容器顶部里插入元素;pop()是删除容器顶部的元素;top()返回容器顶部的元素;size()返回容器的元素个数;begin()是返回一个位于容器的第一个元素的迭代器;end()当然是最后了;empty()是检查是否为空的方法 queue的方法... 阅读全文
posted @ 2013-04-11 03:31 码代码的猿猿 阅读(352) 评论(0) 推荐(0) 编辑
上一页 1 ··· 40 41 42 43 44 45 46 47 48 ··· 50 下一页