infinite

Codeforces Round #597 (Div. 2)

拥有回忆 提交于 2019-12-01 03:43:41
Codeforces Round #597 (Div. 2) -----比赛传送门----- A - Good ol’ Numbers Coloring Problem Description Consider the set of all nonnegative integers: 0,1,2,…. Given two integers a and b (1≤a,b≤104). We paint all the numbers in increasing number first we paint 0, then we paint 1, then 2 and so on. Each number is painted white or black. We paint a number i according to the following rules: if i=0, it is colored white; if i≥a and i−a is colored white, i is also colored white; if i≥b and i−b is colored white, i is also colored white; if i is still not colored white, it is colored black. In this way, each

Would the ability to detect cyclic lists in Haskell break any properties of the language?

假装没事ソ 提交于 2019-12-01 02:51:53
In Haskell, some lists are cyclic: ones = 1 : ones Others are not: nums = [1..] And then there are things like this: more_ones = f 1 where f x = x : f x This denotes the same value as ones , and certainly that value is a repeating sequence. But whether it's represented in memory as a cyclic data structure is doubtful. (An implementation could do so, but this answer explains that "it's unlikely that this will happen in practice" .) Suppose we take a Haskell implementation and hack into it a built-in function isCycle :: [a] -> Bool that examines the structure of the in-memory representation of

博客自定义样式

不想你离开。 提交于 2019-11-30 23:20:47
本篇文章主要是用于记录自己设置过的博客样式,同时自己也在学习。 第一个样式 第一步:进入你的 首页 ,打开 管理 -> 设置 第二步:我在博客皮肤中选择了SimpleMemory,这个皮肤相对来说要轻快、干净,更方便你来修改你的样式 第三部:我的代码部分 页首Html代码 <div id="midground" class="wall"></div> <div id="foreground" class="wall"></div> <div id="top" class="wall"></div> 页面定制CSS代码 #home h1{ font-size:45px; } body{ background-image: url("放你的背景图链接"); background-position: initial; background-size: cover; background-repeat: no-repeat; background-attachment: fixed; background-origin: initial; background-clip: initial; height:100%; width:100%; } #home{ opacity:0.7; } .wall{ position: fixed; top: 0; left: 0; bottom: 0;

How to update a TextView in an activity constantly in an infinite loop?

走远了吗. 提交于 2019-11-30 20:35:44
I have an activity which has a TextView, and I want to update the text constantly.. In Java I could just make an infinite while loop, and just set the text each iteration. But when I try to do that in Android, it shows a black screen, and doesn't even load the activity. I put the infinite in the onCreate method, perhaps that's why it crashes..but if it is, where should I put it? ρяσѕρєя K use Handler and a separate thread/runnable for updating TextView constantly instead of While loop : Handler handler=new Handler(); handler.post(new Runnable(){ @Override public void run() { // upadte textView

Infinite for loops possible in Python?

给你一囗甜甜゛ 提交于 2019-11-30 20:21:46
Is it possible to get an infinite loop in for loop? My guess is that there can be an infinite for loop in Python. I'd like to know this for future references. The quintessential example of an infinite loop in Python is: while True: pass To apply this to a for loop, use a generator (simplest form): def infinity(): while True: yield This can be used as follows: for _ in infinity(): pass To answer your question using a for loop as requested, this would loop forever as 1 will never be equal to 0: for _ in iter(int, 1): pass If you wanted an infinite loop using numbers that were incrementing as per

How do I add infinite scroll with jQuery Masonry?

南楼画角 提交于 2019-11-30 12:50:24
问题 I am trying to incorporate infinite scroll with my current web site that is using a type of jQuery Masonry. I am trying to understand the language and the basic function of javascript (and html in general), but it can be quite overwhelming. I am also seeing different methods to add infinite scroll to a web page, including the use of php. Basically, I have no sense of direction as to which is the best method for my web site. Any tips or help is greatly appreciated. And I apologize for my lack

jQuery Infinite Scrolling/Lazy Loading

左心房为你撑大大i 提交于 2019-11-30 01:45:29
I'm currently redesigning my website and have been looking into using JavaScript and jQuery. Here is what I have so far: http://www.tedwinder.co.uk/gallery2/ . My vision is to have all of the photos on one page, which the user can scroll through, like now. However, I understand the limitations and effects of having 50+ large-ish images on one page and have considered using infinite scrolling and lazy loading, which I understand would only load the images when the user gets to them, or when they click on a "More" link? So, my question is: would this reduce the page load, how exactly would I go

cuda infinite kernel

狂风中的少年 提交于 2019-11-29 15:23:54
I am working on an application for which it is necessary to run a CUDA kernel indefinitely. I have one CPU thread that writes stg on a list and gpu reads that list and resets (at least for start). When I write inside the kernel while(true) { //kernel code } the system hangs up. I know that the GPU is still processing but nothing happens of course. And I am not sure that the reset at the list happens. I have to mention that the GPU used for calculations is not used for display, so no watchdog problem. The OS is Ubuntu 11.10 and cuda toolkit 4.1. I could use any help/examples/links on writing

Haskell- Two lists into a list of tuples

99封情书 提交于 2019-11-29 06:58:21
I am trying to implement a function (described below) that takes two lists (each or both may be infinite) and return a list of tuples of all the possible pairs of elements between the lists zipInf :: [a] -> [b] -> [(a,b)] (e.g the output should be like this, but doesn't have to be exactly like this) zipInf [0 .. 2] ['A' .. 'C'] ~> [(0,'A'),(1,'A'),(0,'B'),(1,'B'),(0,'C'),(2,'A'),(2,'B'),(1,'C'),(2,'C')] zipInf [] [0 ..] ~> [] zipInf [0 ..] [] ~> [] take 9 (zipInf ['A'] [0 .. ]) ~> [('A',0),('A',1),('A',2),('A',3),('A',4),('A',5),('A',6),('A',7),('A',8)] I've started implementing it like this:

css3动画-加载中...

会有一股神秘感。 提交于 2019-11-29 06:04:42
写几个简单的加载中动画吧。 像前面三种都是相当于几个不同的点轮流来播放同一动画:变大变小。css3里面有一个用于尺度变换的方法: scale( x , y ) : 定义 2D 缩放转换,改变元素的宽度和高度 。 第四种就是一个小球从上往下跌落,再弹回去,在上面的时候速度最小,下面的时候速度最大。由于该小球只进行了上下的移动,所以我们可以运用: translateY( n ):定义 2D 转换,沿着 Y 轴移动元素, 从而实现小球沿Y方向来回移动。 废话不多说了,上代码。 首先,第一个加载中的动画: 1 < div id ="loading1" > 2 < div class ="demo1" ></ div > 3 < div class ="demo1" ></ div > 4 < div class ="demo1" ></ div > 5 < div class ="demo1" ></ div > 6 < div class ="demo1" ></ div > 7 </ div > html Code 1 .demo1 { 2 width : 4px ; 3 height : 4px ; 4 border-radius : 2px ; 5 background : #68b2ce ; 6 float : left ; 7 margin : 0 3px ; 8