摘要: 题目:http://codeforces.com/contest/262/problem/Bn个数按不递减的顺序排好k次取相反数思路:一边读入数据,一边做取反操作一开始忽略了有k>n且所有数为负数的情况,导致没有进行k次取反,只进行了n次。#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main(){ int n,k; long long sum=0; cin >> n >> k; int min=10005; bool o 阅读全文
posted @ 2013-01-16 20:40 Daniel Qiu 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/255/problem/A#include <iostream>#include <cstdlib>using namespace std;int main(){ int n; int arr[25]; int muscle[3]={0,0,0}; cin >> n; for(int i=0;i<n;i++) { int temp; cin >> temp; muscle[i%3]+=temp; } int maxi=0,max=muscl... 阅读全文
posted @ 2013-01-16 18:41 Daniel Qiu 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/259/problem/A判断一个棋盘经过行操作后能否成为一个正常的黑白相间的棋盘思路:因为不涉及列操作 只要每行都是黑白相间就可以满足条件#include <iostream>#include <cstdlib>using namespace std;int a,b,n;int main(){ bool ans=true; char start,previous,current; for(int i=0;i<8;i++) { cin >> current; start=pre... 阅读全文
posted @ 2013-01-16 17:29 Daniel Qiu 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/260/problem/A思路:a%b==0 => a*10^n%b==0这题一开始忽略了一句话If there are multiple possible answers, print any of them.想了半天觉得答案不只一种啊然后看到n的范围就知道这题不可能一位位算#include <iostream>#include <cstdlib>using namespace std;int a,b,n;int main(){ cin >> a>>b>>n; 阅读全文
posted @ 2013-01-16 17:05 Daniel Qiu 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/257/problem/A给出接线板 用电器 原有插座的数量;给出每个接线板的插座个数;求最少需要多少插线板;思路:贪心法#include <iostream>#include <cstdlib>using namespace std;int n,m,k;int arr[55];int cmp(const void *a,const void *b){ return *((int *)b)-*((int *)a);}int main(){ cin >> n >> m >> 阅读全文
posted @ 2013-01-16 16:42 Daniel Qiu 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/262/problem/A#include <iostream>#include <stdio.h>#include <string.h>using namespace std;int main(){ int n,k; cin >> n >> k; int num; int ans=0; char digit[10]; for(int i=0;i<n;i++) { int counter=0; cin >> num; int flag=1; ... 阅读全文
posted @ 2013-01-16 15:15 Daniel Qiu 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=3030思路:模拟题#include <iostream>using namespace std;int main(){ int n; cin >> n; int r,e,c; for(int i=0;i<n;i++) { cin >> r >> e >> c; if(r<e-c) cout << "advertise" <<endl; else if(r==e-c) cout << "does no 阅读全文
posted @ 2013-01-16 14:18 Daniel Qiu 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题目:http://hustoj.sinaapp.com/problem.php?id=1843这题我做了有五个小时...就是没读懂题目中 "从每一个数字开始数一次" 是什么意思...思路:既然是循环我就构建了个循环链表,然后从M往上一个个枚举。#include <iostream>#include <cmath>#include <stdio.h>using namespace std;int digit[10];int num;struct nodes{ int n; nodes *next;}node[10];void create 阅读全文
posted @ 2013-01-16 00:03 Daniel Qiu 阅读(235) 评论(0) 推荐(0) 编辑