摘要: 递归求解 非常巧妙/*The input begins with a single positive integer on a line by itself indicating the numberof the cases following, each of th... 阅读全文
posted @ 2018-04-21 10:28 MCQ 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 给下落的深度和小球个数,小球依次下落,结点有个开关,每到一个结点,开关关向左,开向右一开始想到了简单模拟,结果超时…[cpp] view plain copy#include #include #include #define maxn 20 usin... 阅读全文
posted @ 2018-04-19 16:27 MCQ 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 数组模拟链表#include#include#includeusing namespace std;const int maxn =1000000+5;int last,cur,nex[maxn];char s[maxn];int main(){ while(c... 阅读全文
posted @ 2018-04-17 13:11 MCQ 阅读(60) 评论(0) 推荐(0) 编辑
摘要: /*Sample Input9A 50 10B 10 20C 20 5D 30 35E 35 15F 15 5G 5 10H 10 20I 20 25ABC(AA)(AB)(AC)(A(BC))((AB)C)(((((DE)F)G)H)I)(D(E(F(G(HI)))... 阅读全文
posted @ 2018-04-17 00:21 MCQ 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 我用优先级队列做的,需要打表不然会超时。注意:1200也是rd所以判断条件应该为n%100!=…/*Sample Input1234111213212223100100058420Sample OutputThe 1st humble number is 1.The ... 阅读全文
posted @ 2018-04-16 16:05 MCQ 阅读(99) 评论(0) 推荐(0) 编辑
摘要: /*Sample Input32005 251855 122004 10000Sample Output2108190443236*/#include using namespace std;bool ifrun(int y){ if((y%4==0&&y%10... 阅读全文
posted @ 2018-04-15 23:07 MCQ 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 水题。找规律,从第二开始每四个/*There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).InputInput consists o... 阅读全文
posted @ 2018-04-14 07:38 MCQ 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 又是一个坑题,注意求最小公倍数时先除后乘,不然会超范围,然后就wa..../*The least common multiple (LCM) of a set of positive integers is the smallest positive integer ... 阅读全文
posted @ 2018-04-13 22:34 MCQ 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 水题,没注意大数。。wa无数次#include #includeint main(){ char a[1500]; int sum; while(scanf("%s",&a)!=EOF) { if(strlen(a)==1&&a[... 阅读全文
posted @ 2018-04-13 22:12 MCQ 阅读(60) 评论(0) 推荐(0) 编辑
摘要: 刚开始这题看起来比较容易,因为直接用递归的话很容易搞定。但是提交的时候总是不AC,仔细一看有很多格式限制,比如内存,运行时间,堆栈大小等的限制。所以递归是行不通的。 在网上查看了一下相关思路,再看看n的范围可以那么大,用一般方法肯定不行,这时候就要想到其中的规律。我们... 阅读全文
posted @ 2018-04-13 22:03 MCQ 阅读(144) 评论(0) 推荐(0) 编辑