摘要: 题目链接:http://codeforces.com/contest/404/problem/B 模拟题,但是数据很大,可能会溢出。所以要使用一些防止溢出。 刚开始写没有注意防止溢出,结果过不了后面的数据,下面是没有通过的代码:///2014.3.19///Codeforces Round #237 Div.2///B#include #include using namespace std;int main(){ // freopen("in","r",stdin); // freopen("out","w",s 阅读全文
posted @ 2014-03-20 21:37 basement_boy 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/contest/404/problem/A模拟题,第一次没有考虑对角线上的字符和其余地方的字符是相同的的情况,改掉后就OK了。 1 ///2014.3.19 2 ///Codeforces Round #237 Div.2 3 ///A 4 5 #include 6 #include 7 using namespace std; 8 9 char table[310][310];10 11 int main()12 {13 // freopen("in","r",stdin);14 // freope 阅读全文
posted @ 2014-03-20 21:29 basement_boy 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/contest/402/problem/C 刚刚看了题目完全没有头绪,看了题解还是不理解为什么。但直接根据题解写代码A掉了。最后想想,题解的思路是这样的:要得到满足条件的图,则应该让边尽可能的分布在每两个点之间。这样才能任选一部分点使得这部分构成的子图的边数的最大值尽可能小。 1 ///2014.3.18 2 ///codeforces round #236 div.2 3 ///C 4 5 #include 6 #include 7 using namespace std; 8 9 int main()10 {11 //... 阅读全文
posted @ 2014-03-20 21:26 basement_boy 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/contest/402/problem/B暴力求解,第一次做没有考虑到剪切后树的高度不能为零和负值,WA了,改掉后就OK了 1 ///2014.3.16 - 2014.3.18 2 ///codeforces round #236 div.2 3 ///B 4 5 #include 6 #include 7 using namespace std; 8 9 int n;10 int k;11 int tree[1050];12 13 int numOfNotCutTree;14 int numNotCut;15 16 bool in... 阅读全文
posted @ 2014-03-20 21:21 basement_boy 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/contest/402/problem/A第一次做codeforces。第一道水题,没什么算法,直接贴代码。 1 ///2014.3.16 2 ///codeforces round #236 div.2 3 ///A 4 5 #include 6 #include 7 using namespace std; 8 9 int main()10 {11 int k,a,b,v;12 scanf("%d%d%d%d",&k,&a,&b,&v);13 int n = 0;14 while( a 阅读全文
posted @ 2014-03-20 21:17 basement_boy 阅读(155) 评论(0) 推荐(0) 编辑