There are K nuclear reactor chambers labelled from 0 to K-1. Particles are bombarded onto chamber 0. The particles keep collecting in the chamber 0. However if at any time, there are more than N particles in a chamber, a reaction will cause 1 particl…
Arranging Cup-cakes Our Chef is catering for a big corporate office party and is busy preparing different mouth watering dishes. The host has insisted that he serves his delicious cupcakes for dessert. On the day of the party, the Chef was over-seein…
Input t – the number of numbers in list, then t lines follow [t <= 10^6]. Each line contains one integer: N [0 <= N <= 10^6] Output Output given numbers in non decreasing order. Example Input: 5 5 3 6 7 1 Output: 1 3 5 6 7 大数据的排序,输入和输出. 一開始使用了co…
Chapter 1: Building Abstractions with Procedures 2015-09-29 016 Preface of this chapter QUOTE: The acts of the mind, where in it exerts its power over simple ideas, are chiefly these three ...... (John Locke, An Essay Concerning Human Understanding).…
China's appetite for coal, once seemingly unlimited, is starting to wane, and the effects are rippling far from the Middle Kingdom. wane:衰落,退潮,衰减 ripple:波纹,涟漪 With the world's second-largest economy, China in recent years has been driving demand for…
http://www.codechef.com/NOV13 还在比...我先放一部分题解吧... Uncle Johny 排序一遍 struct node{ int val; int pos; }a[MAXN]; int cmp(node a,node b){ return a.val < b.val; } int main(){ int T,n,m; while(cin>>T){ while(T--){ cin>>n; ; i < n ; i++){ cin>&…
找出一个数组中的三个数,三个数不能组成三角形. 三个数不能组成三角形的条件是:a + b < c 两边和小于第三边. 这个问题属于三个数的组合问题了.暴力法可解,可是时间效率就是O(n*n*n)了,非常慢. 只是既然是组合问题就必然能够使用排序后处理的方法减少时间效率的. 这里减少时间效率的方法是: 选一个最大的数c.然后选两个小数a和b,当中a < b,假设符合条件,那么两个数中间的数必然都能够作为b符合条件a + b < c 这样能够把时间效率降到O(n*n). 这个规律也不好找啊.…
比赛链接:https://www.codechef.com/FEB18,题面和提交记录是公开的,这里就不再贴了 Chef And His Characters 模拟题 Chef And The Patents 模拟题 Permutation and Palindrome 模拟题 Car-pal Tunnel 结论比较简单 Broken Clock 求余弦的n倍角,可以用复数的快速幂解决 $cos(a)=x \\ sin(a)=\sqrt{1-x^2} \\ cos(na) = Re((x+\sq…