随笔分类 -  ACM~~CoderForces

摘要:A. Laptops题目意思: 给定n台电脑,第i台电脑的价格是ai ,质量是bi,问是否存在一台电脑价格比某台电脑价格底,但质量确比某台电脑的质量高,即是否存在ai bj?解题思路: 这题一定要看题目,a都是1~n的不同数,b也是1~n的不同数,此题只需要判断ai是否等于bi,如果ai!= b... 阅读全文
posted @ 2014-08-10 22:57 OpenSoucre 阅读(426) 评论(0) 推荐(0)
摘要:A. Little Pony and Crystal Mine水题,每行D的个数为1,3.......n-2,n,n-2,.....3,1,然后打印即可#include #include #include #include using namespace std;int main(){ int... 阅读全文
posted @ 2014-08-02 16:36 OpenSoucre 阅读(693) 评论(0) 推荐(0)
摘要:A - Game With Sticks题目的意思: n个水平条,m个竖直条,组成网格,每次删除交点所在的行和列,两个人轮流删除,直到最后没有交点为止,最后不能再删除的人将输掉解题思路: 每次删除交点所在的行和列,则剩下n-1行和m-1列,直到行或列被删完为止,最多删除的次数为min(n,m),... 阅读全文
posted @ 2014-07-25 16:03 OpenSoucre 阅读(610) 评论(0) 推荐(0)
摘要:A - Jzzhu and Children找到最大的ceil(ai/m)即可#include #include using namespace std;int main(){ int n,m; cin >> n >> m; double a, maxv = 0; int m... 阅读全文
posted @ 2014-07-20 13:34 OpenSoucre 阅读(598) 评论(0) 推荐(0)
摘要:A - Rewards水题,把a累加,然后向上取整(double)a/5,把b累加,然后向上取整(double)b/10,然后判断a+b是不是大于n即可#include #include #include #include using namespace std;int main(){ dou... 阅读全文
posted @ 2014-07-18 09:55 OpenSoucre 阅读(268) 评论(0) 推荐(0)
摘要:A - DZY Loves Hash水题,开辟一个数组即可#include #include #include #include using namespace std;int main(){ int p,n; cin >> p >> n; vector buckets(302,f... 阅读全文
posted @ 2014-07-14 15:17 OpenSoucre 阅读(328) 评论(0) 推荐(0)
摘要:先生成nXm的BW棋盘BWBWBWBWWBWBWBWBBWBWBWBWWBWBWBWB类似上面交替变换然后将输入为’-’的地方替换成‘-’即可#include #include #include #include using namespace std;int main(){ int n,m;... 阅读全文
posted @ 2014-07-06 23:22 OpenSoucre 阅读(283) 评论(0) 推荐(0)
摘要:关于证明可以参考题解http://codeforces.com/blog/entry/12739就是将概率从大到小排序然后,然后从大到小计算概率#include #include #include #include #include #include using namespace std;int ... 阅读全文
posted @ 2014-06-20 20:44 OpenSoucre 阅读(175) 评论(0) 推荐(0)
摘要:本题要考虑字符串本身就存在tandem,如测试用例aaaaaaaaabbb3输出结果应该是8而不是6,因为字符串本身的tanderm时最长的故要考虑字符串本身的最大的tanderm和添加k个字符后最大的tanderm#include #include #include #include #inclu... 阅读全文
posted @ 2014-06-20 17:15 OpenSoucre 阅读(345) 评论(0) 推荐(0)
摘要:题目很简单,只需要注意带空格的输入用getline即可#include #include #include #include #include using namespace std;int main(){ string str; getline(cin,str); set a; ... 阅读全文
posted @ 2014-06-20 17:11 OpenSoucre 阅读(143) 评论(0) 推荐(0)
摘要:此题用贪心求解,首先将caramel drop类别的糖果按照高度从小到大排序,如果高度相同,按照重量从小到大排序将fruit drop类别的糖果按照高度从小到大排序,如果高度相同,按照重量从小到大排序现在有两种可能第一种可能是第一个获得的糖果是caramel drop,则先搜索caramel dro... 阅读全文
posted @ 2014-06-14 23:56 OpenSoucre 阅读(309) 评论(0) 推荐(0)
摘要:注意题目给的是一个nxm的park,设元素为aij,元素aij 有4种可能U(上移),D(下移),L(左移),R(右移)假设第i行第j列元素aij(注意元素的索引是从0开始的)当aij为D时,此时spiders一直往下移动不可能与Om Nom相遇当aij为U时,此时spiders向上移动时此时Nor... 阅读全文
posted @ 2014-06-14 20:52 OpenSoucre 阅读(299) 评论(0) 推荐(0)
摘要:暴利搜索即可#include #include #include using namespace std;int main(){ int n,k,x; cin >> n >> k >> x; vector c(n); for(int i = 0 ; i > c[i]; ... 阅读全文
posted @ 2014-06-13 21:05 OpenSoucre 阅读(189) 评论(0) 推荐(0)
摘要:水到家了#include #include #include using namespace std;struct Point{ int index, pos; Point(int index_ = 0, int pos_ = 0){ index = index_; ... 阅读全文
posted @ 2014-06-13 18:30 OpenSoucre 阅读(151) 评论(0) 推荐(0)
摘要:模拟即可#include #include #include using namespace std;int main(){ vector a(5); for(int i = 0; i > g[i][j]; } } int maxHappiness = 0; ... 阅读全文
posted @ 2014-06-13 17:53 OpenSoucre 阅读(246) 评论(0) 推荐(0)
摘要:水题#include #include #include using namespace std;int main(){ vector a(4); cin >> a[0] >> a[1]>>a[2]>>a[3]; string str; cin >> str; int res = 0; for(in... 阅读全文
posted @ 2014-06-13 17:25 OpenSoucre 阅读(154) 评论(0) 推荐(0)
摘要:看到题目的时候,以为类似插入排序,比较第i个元素和第i-1个元素,如果第i个元素比第i-1个元素小,则不交换如果第i个元素比第i-1个元素大,则交换第i个元素和第i-1个元素 继续比较第i-1个元素与前一个元素,直到前一个元素大为止交换元素次大于等于k则停止但对测试用例1234 3则出现问题,如果... 阅读全文
posted @ 2014-06-13 17:14 OpenSoucre 阅读(195) 评论(0) 推荐(0)
摘要:screen 尺寸为a:bvideo 尺寸为 c:d如果a == c 则 面积比为 cd/ab=ad/cb (ad c/d,则ad/bd > cb/db 则(ad > cb) screen尺寸可为 ad:bd, video的尺寸可为 cb:db 面积比为:cb*db/ad*bd = cb/ad... 阅读全文
posted @ 2014-06-12 20:28 OpenSoucre 阅读(166) 评论(0) 推荐(0)
摘要:水题,注意数据范围即可#include #include #include using namespace std;typedef pair Point;int main(){ int x,y; cin >> x >>y; Point a,b; if((x>0 && y > ... 阅读全文
posted @ 2014-06-12 11:28 OpenSoucre 阅读(137) 评论(0) 推荐(0)
摘要:水题#include #include #include using namespace std;int main(){ int n,m; cin >> n >> m; int cnt = 0, sum = 0; for(int i = 0 ; i > a; i... 阅读全文
posted @ 2014-06-10 12:10 OpenSoucre 阅读(132) 评论(0) 推荐(0)