摘要:
#include #include #include using namespace std;int main(){ int n; cin>>n; while(n--) { map count; map::iterator iter; int m; string temp; cin>>m>>temp; for(int i=0; isecond+1; } } } return ... 阅读全文
posted @ 2015-01-29 11:39
sober_reflection
阅读(122)
评论(0)
推荐(0)
摘要:
#include #include #include #include #define MAX 10001//[(物体数-1)÷抽屉数]+1//给出N 个数,在其中找出m个数,使得m个数的和是N的倍数,输出m以及任意顺序这m个数,只要输出一种情况。/*可以把和求出来,然后对n取余,因为有n个和,对n取余,如果余数中没有出现0,根据鸽巢原理,一定有两个数的余数相同,两个和想减就是n的倍数。如果余数出... 阅读全文
posted @ 2015-01-29 11:39
sober_reflection
阅读(135)
评论(0)
推荐(0)
摘要:
#include #include #include using namespace std;int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF && n!=-1 && m!=-1) { set R_num; set B_num; for(int i=1; i::iterator iter; for(iter=R_num.begin(... 阅读全文
posted @ 2015-01-29 11:38
sober_reflection
阅读(176)
评论(0)
推荐(0)
摘要:
#include #include using namespace std;int cmp(const void *a, const void *b){ return ( *(int *)a - *(int *)b );}int binary_search( int *a, int n, int key ) //二份检索{ qsort(a, n, sizeof(a[0]), cmp); int... 阅读全文
posted @ 2015-01-29 11:37
sober_reflection
阅读(149)
评论(0)
推荐(0)
摘要:
/**************************************************** 该题充分运用与运算的特点,成对消除,单的最后留下 ****************************************************/#include #include #include using namespace std;int main(){ char str1... 阅读全文
posted @ 2015-01-29 11:37
sober_reflection
阅读(114)
评论(0)
推荐(0)
摘要:
#include #include #include using namespace std;#define INF 0xfffff //因为为了辨别是否有负权,所以INF不能开太大#define MAX 1100int dist[MAX], pre[MAX], path[MAX][MAX];bool sign[MAX];void initialize(int n) //初始化{ fo... 阅读全文
posted @ 2015-01-29 11:37
sober_reflection
阅读(172)
评论(0)
推荐(0)
摘要:
#include #include #include #include using namespace std;struct node{ int x, y, z, h;};bool cmp(node a, node b){ return a.x*a.y b) {t=a; a=b; b=t;} if(a>c) {t=a; a=c; c=t;} if(b>c) {t=b; b=c; c=t;}}int... 阅读全文
posted @ 2015-01-29 11:35
sober_reflection
阅读(147)
评论(0)
推荐(0)
摘要:
#include #include #include using namespace std;void multiple ( int x[2][2], int y[2][2] ){ int temp[2][2] temp[0][0] = (;x[0][0]*y[0][0]+x[0][1]*y[1][0])%10000; temp[0][1] = (x[0][0]*y[0][1]+x[0... 阅读全文
posted @ 2015-01-29 11:34
sober_reflection
阅读(132)
评论(0)
推荐(0)
摘要:
#include #include #include int s,n;int row,col;void output(int step,int num){ int i; if(step==0) //第一行 { if(num==1 ||num==4) { for(i=0;i<col;i++) print... 阅读全文
posted @ 2015-01-29 11:34
sober_reflection
阅读(200)
评论(0)
推荐(0)
摘要:
#include #include #include #include #include using namespace std;int main(){ int n; //string in,out; char in[1000],out[1000]; while(cin>>n>>in>>out) { //stack s; char s[1000]; memset(s,'\0',sizeof(... 阅读全文
posted @ 2015-01-29 11:34
sober_reflection
阅读(116)
评论(0)
推荐(0)