摘要: 题目:http://codeforces.com/contest/265/problem/C这题本来会做的 结果比赛的时候少打了个0..最后判定的时候runtime error了...#include <iostream>#include <stdio.h>#include <cstring>#include <cmath>using namespace std;char arr[1000005];int ans[1000005];int lp,rp;int main(){ cin.getline(arr,1000005); int len=st 阅读全文
posted @ 2013-01-21 23:32 Daniel Qiu 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/265/problem/B#include <iostream>#include <stdio.h>#include <cstring>#include <cmath>using namespace std;int arr[100000];int main(){ int n; cin>>n; for(int i=0;i<n;i++) { cin >> arr[i]; } int ans=2*n-1+arr[0]; for(int i=0;i<n- 阅读全文
posted @ 2013-01-21 23:24 Daniel Qiu 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/265/problem/A#include <iostream>#include <stdio.h>#include <cstring>using namespace std;char str[55];char ins[55];int main(){ cin.getline(str,55); cin.getline(ins,55); int slen=strlen(str); int ilen=strlen(ins); int i; for(i=0;i<slen;) { f... 阅读全文
posted @ 2013-01-21 23:22 Daniel Qiu 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/236/problem/A思路:模拟法#include <iostream>#include <cstring>using namespace std;int arr[26];int main(){ char str[100]; cin>>str; int charnum[100]; for(int i=0;i<26;i++) { arr[i]=0; } for(int i=0;i<strlen(str);i++) { charnum[i]=str[i]... 阅读全文
posted @ 2013-01-20 14:21 Daniel Qiu 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/237/problem/A#include <iostream>using namespace std;int main(){ int ans=1; int n; cin>>n; int ap,bp; int a,b; cin>>a>>b; ap=a; bp=b; int counter=1; for(int i=0;i<n-1;i++) { cin>>a>>b; if((a==ap)&&(b==bp)) { ... 阅读全文
posted @ 2013-01-20 14:03 Daniel Qiu 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/242/problem/A抛硬币 输出各种满足条件的结果#include <iostream>using namespace std;int arr[10000][2];int main(){ int x,y,a,b; cin>>x>>y>>a>>b; int n=0; for(int i=a;i<=x;i++) { for(int j=b;j<=y;j++) { if(i>j) { arr[n]... 阅读全文
posted @ 2013-01-20 11:09 Daniel Qiu 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/246/problem/A题目给出错误的冒泡排序法,求反例。思路:...既然是错误的,任意输出一个递减的数列#include <iostream>using namespace std;int main(){ int n; cin>>n; if(n<=2) cout<<"-1"; else { for(int i=0;i<n-2;i++) { cout<<n-i<<" "; } cout<<"2 阅读全文
posted @ 2013-01-19 22:32 Daniel Qiu 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/248/problem/An个橱柜 每个橱柜左右两扇门 用0、1纪录关和开的状态,问要使所有左门状态相同,右门状态相同,最少需要对门做几次操作思路:贪心法 分别统计左右门,输出关闭的状态和打开的状态中的较小值。#include <iostream>using namespace std;int l,r;int lopen=0,lclose=0,ropen=0,rclose=0;int main(){ int n; cin>>n; for(int i=0;i<n;i++) { cin >> 阅读全文
posted @ 2013-01-19 22:00 Daniel Qiu 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/250/problem/A将数列分割城若干个数列,每个子数列的负元素不得超过两个,使子数列个数最少,输出子数列个数,和每个子数列元素个数。思路:贪心法#include <iostream>using namespace std;int a[100];int b[100];int bi=0;int bn=1;int main(){ int n; cin>>n; for(int i=0;i<n;i++) { cin >> a[i]; } int neg=0; for(int i=0;i< 阅读全文
posted @ 2013-01-19 21:43 Daniel Qiu 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目: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) 编辑