摘要: D - Three Integers 思路:枚举,还是枚举,走完所有的数字,最后找到最小的,然后输出。 代码: #include <iostream> #include<algorithm> #include<string> #include<math.h> using namespace std; 阅读全文
posted @ 2020-03-13 22:47 PCDL&TIPO 阅读(169) 评论(0) 推荐(0) 编辑
摘要: C - Perform the Combo 思路:当读到这个题的时候,第一反应就是枚举,但是,无线超时,没办法,那就变,利用前缀和,减少时间。 代码: #include<iostream> #include<string> #include<algorithm> #define MAX 200005 阅读全文
posted @ 2020-03-13 22:39 PCDL&TIPO 阅读(139) 评论(0) 推荐(0) 编辑
摘要: B - WeirdSort 思路:经过认真的审题,你会发现,这只是个冒泡的变形,我们建立两个数组,然后用一个数组里面的数字确定位置,然后冒泡就行了。最后抖机灵用了个is_sorted,判断数组里面数字的排列顺序。 代码: #include<iostream> #include<algorithm> 阅读全文
posted @ 2020-03-13 22:33 PCDL&TIPO 阅读(214) 评论(0) 推荐(0) 编辑
摘要: A - Add Odd or Subtract Even 思路:其实认真观察就能发现,这个与输入的书有关系,且答案为0,1,2。先看相同,不用加减,为0,再看前小后大,因为加奇数减偶数,如果,相差奇数,为1,相差偶数,为2,同理可得前大后小的答案。 代码: #include<iostream> #i 阅读全文
posted @ 2020-03-13 22:27 PCDL&TIPO 阅读(179) 评论(0) 推荐(0) 编辑