摘要: 题目:http://www.codeforces.com/problemset/problem/252/A输出元素格个小于100的数列中连续子数列的异或最大值思路:个数小于100 直接枚举#include <iostream>#include <stdio.h>using namespace std;int arr[100];int ans=0;int main(){ int n; cin>>n; for(int i=0;i<n;i++) { cin>>arr[i]; } for(int i=0;i<n;i++) { int... 阅读全文
posted @ 2013-01-17 21:03 Daniel Qiu 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/problemset/problem/253/A男女排队,男生多则男生站第一位vice versa#include <iostream>#include <stdio.h>using namespace std;int main(){ freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); int n,m; cin>>n>>m; if(n> 阅读全文
posted @ 2013-01-17 20:15 Daniel Qiu 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/problemset/problem/255/B这题被ljc剧透了...#include <iostream>#include <stdio.h>#include <cmath>using namespace std;int main(){ char c; int xnum=0,ynum=0; while((c=cin.get())!=EOF) { if(c=='x') xnum++; else if(c=='y') ynum++; } int t=abs(xnum-ynum) 阅读全文
posted @ 2013-01-17 19:47 Daniel Qiu 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/problemset/problem/254/A 给出n个数据,如果能分为2n对数据,每对数据相同 则输出这n对数据的标号 否则输出-1思路:这题一开始是暴力法...果然超时 然后看到1 ≤ ai ≤ 5000 于是开了一个a[5000]的数组 #include <iostream>#include <stdio.h>using namespace std;int a[5000];int pairs[1000000][2];int main(){ int counter=0; freopen("input.tx 阅读全文
posted @ 2013-01-17 19:03 Daniel Qiu 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/259/problem/B一个magic square满足每行每列每对角线的和相等给出一个除去主对角线(main diagonal)的square 求magic square思路:这题受input sample的影响,一开始傻逼了...以为每个数都小于10...然后就枚举了...然后发现数据的上限是105... 正解是 设每行每列每对角线的和为sum,magic square中所有数字加起来的和为3*sum; 所以剩下的数的和为2*sum#include <iostream>using namespace std;i 阅读全文
posted @ 2013-01-17 15:33 Daniel Qiu 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/257/problem/B思路:找规律...#include <iostream>using namespace std;int main(){ int n,m; int p,v; cin >> n >> m; if(n>m) { int t; t=n; n=m; m=t; } p=m-1; v=n; cout << p<<" "<<v; return 0;} 阅读全文
posted @ 2013-01-17 14:47 Daniel Qiu 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/263/problem/B在第一象限画n个以原点为顶点,(ai,ai)为对角顶点的正方形输出任意一个k为顶点的正方形思路:任意一个点,选正方形的顶点#include <iostream>#include <cstdlib>using namespace std;int arr[55];int cmp(const void *a,const void *b){ return *((int *)b)-*((int *)a);}int main(){ int n,k; cin>>n >> 阅读全文
posted @ 2013-01-17 02:20 Daniel Qiu 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/263/problem/A#include <iostream>#include <cmath>using namespace std;int main(){ int t; int row,col; for(int i=0;i<5;i++) { for(int j=0;j<5;j++) { cin >>t; if(t==1) { row=i+1; co... 阅读全文
posted @ 2013-01-17 02:15 Daniel Qiu 阅读(102) 评论(0) 推荐(0) 编辑