判断一个整数是否介于两个整数(含已知值)之间的最快方法

Is there a faster way than x >= start && x <= end in C or C++ to test if an integer is between two integers?

UPDATE: My specific platform is iOS. This is part of a box blur function that restricts pixels to a circle in a given square.

UPDATE: After trying the accepted answer, I got an order of magnitude speedup on the one line of code over doing it the normal x >= start && x <= end way.

UPDATE: Here is the after and before code with assembler from XCode:

NEW WAY

// diff = (end - start) + 1
#define POINT_IN_RANGE_AND_INCREMENT(p, range) ((p++ - range.start) < range.diff)

Ltmp1313:
 ldr    r0, [sp, #176] @ 4-byte Reload
 ldr    r1, [sp, #164] @ 4-byte Reload
 ldr    r0, [r0]
 ldr    r1, [r1]
 sub.w  r0, r9, r0
 cmp    r0, r1
 blo    LBB44_30

OLD WAY

#define POINT_IN_RANGE_AND_INCREMENT(p, range) (p <= range.end && p++ >= range.start)

Ltmp1301:
 ldr    r1, [sp, #172] @ 4-byte Reload
 ldr    r1, [r1]
 cmp    r0, r1
 bls    LBB44_32
 mov    r6, r0
 b      LBB44_33
LBB44_32:
 ldr    r1, [sp, #188] @ 4-byte Reload
 adds   r6, r0, #1
Ltmp1302:
 ldr    r1, [r1]
 cmp    r0, r1
 bhs    LBB44_36

Pretty amazing how reducing or eliminating branching can provide such a dramatic speed up.

转载于:https://stackoverflow.com/questions/17095324/fastest-way-to-determine-if-an-integer-is-between-two-integers-inclusive-with

csdnceshi71
Memor.の For the curious, this function was used in the blur tool in the app I wrote, You Doodle for iOS - bit.ly/YouDoodleApp
5 年多之前 回复
csdnceshi61
derek5. You really should have posted your real code much sooner. The ++ makes a big difference...
大约 7 年之前 回复
csdnceshi76
斗士狗 What about the data loading optimization? Did you try to use smaller data types, save it in offset of the other register? When you have 2 values in one 32b data type, you can still load it with ldr and then use offsets which you will compare.
大约 7 年之前 回复
weixin_41568126
乱世@小熊 It's true that I don't have all that much experience with C++, but as far as I can tell a pointer-to-struct (or to class instance) still needs -> to access its members, just as in C. I don't believe it would be necessary if it were a reference to the struct, but that would not allow the incrementing without an overload for the ++ operator.
大约 7 年之前 回复
csdnceshi71
Memor.の Thanks for the link, I will do that.
大约 7 年之前 回复
csdnceshi60
℡Wang Yan FYI you should turn those #define's into inline functions (it will not hurt performance at all). See here for the reason why.
大约 7 年之前 回复
csdnceshi71
Memor.の It's not an iterator, it's just a pointer to a struct.
大约 7 年之前 回复
weixin_41568126
乱世@小熊 Oh wait, if it's a pointer reference and based on the usage (should've noticed it by the use of dot notation next to the incrementing), is p an iterator? I guess I can see how that could provide a performance impact if the overloaded ++ in the iterator doesn't get inlined/optimized.
大约 7 年之前 回复
csdnceshi71
Memor.の Correct. Yes it's not the easiest code to follow but it is a pointer reference.
大约 7 年之前 回复
csdnceshi52
妄徒之命 I take it back, I didn't realize that && defined a sequence point. See stackoverflow.com/questions/4176328/…. And I imagine you call the macro with a pointer reference i.e. *p? That would work then, but it's not the easiest code to follow.
大约 7 年之前 回复
csdnceshi71
Memor.の Good point, I will rename the macro to indicate that there is an increment going on
大约 7 年之前 回复
weixin_41568126
乱世@小熊 I wouldn't recommend the usage of p++ rather than just p inside the macro anyway. It may make your code slightly shorter as you don't have to increment p after usage of the macro, but by including it in the macro you're possibly violating an assumption that most programmers probably make (that a bounds check will not modify the values involved in the check).And if a difference of a few cycles per macro use on average is enough to make a big perf difference, then you may want to look into reducing the number of times the macro is used. microopts sometimes ignore the actual perf issues
大约 7 年之前 回复
csdnceshi71
Memor.の That is intentional. I did not want p to increment in the original code to save a few cycles. Once it got past the right edge or bottom edge of the circle the condition would return false without doing the second comparison. Visually, the blur looks the same with both methods.
大约 7 年之前 回复
csdnceshi52
妄徒之命 You were skating on thin ice with your old way, since the increment wasn't guaranteed to happen in the sequence you might assume. For that matter I don't understand why it's there at all, since you seem to be incrementing the value and not a pointer.
大约 7 年之前 回复
weixin_41568184
叼花硬汉 I think there was a bug in your original code. It would not increment p if the first comparison was false. The new code always increments p. This may explain the bulk of your speed up.
大约 7 年之前 回复
csdnceshi71
Memor.の yes it has shaders but my app is using quartz2d and cgbitmap context for everything.
大约 7 年之前 回复
csdnceshi59
ℙℕℤℝ "This is part of a box blur function" Doesn't iphone have shaders?
大约 7 年之前 回复
csdnceshi62
csdnceshi62 regarding we should ask such questioners to provide more detail: That's not what you did. Your comment was Don't worry about it. The optimizer is extremely good.
大约 7 年之前 回复
csdnceshi70
笑故挽风 did you try the non lazy and x >= start & x <= end (to avoid the extra branch)
大约 7 年之前 回复
weixin_41568110
七度&光 No; we should ask such questioners to provide more detail.
大约 7 年之前 回复
csdnceshi71
Memor.の start, end and value are all between 0 and n, where n is usually less than 128
大约 7 年之前 回复
csdnceshi71
Memor.の This is a bottleneck in a function in one of my apps
大约 7 年之前 回复
csdnceshi74
7*4 I would suggest this question is meaningless in c. If you asked "in assembly on a very specific platform", there might be a reasonable answer. So as asked, it is not a valid question, even an academic one.
大约 7 年之前 回复
csdnceshi67
bug^君 it doesn't matter why the question is being asked. It's a valid question, even if the answer is no
大约 7 年之前 回复
csdnceshi75
衫裤跑路 So we should just ignore all such questions blindly and just say "let the optimizer do it?"
大约 7 年之前 回复
weixin_41568110
七度&光 Not really. It depends on exactly which compiler, optimizer, platform, data type, and who knows what else.
大约 7 年之前 回复
csdnceshi75
衫裤跑路 Who cares why, its an interesting question. Its just a challenge for the sake of a challenge.
大约 7 年之前 回复
weixin_41568110
七度&光 Don't worry about it. The optimizer is extremely good.
大约 7 年之前 回复
csdnceshi68
local-host Is this particular test the bottleneck in your application?
大约 7 年之前 回复
csdnceshi79
python小菜 Why are you concerned that this isn't fast enough for you?
大约 7 年之前 回复

5个回答

There's an old trick to do this with only one comparison/branch. Whether it'll really improve speed may be open to question, and even if it does, it's probably too little to notice or care about, but when you're only starting with two comparisons, the chances of a huge improvement are pretty remote. The code looks like:

// use a < for an inclusive lower bound and exclusive upper bound
// use <= for an inclusive lower bound and inclusive upper bound
// alternatively, if the upper bound is inclusive and you can pre-calculate
//  upper-lower, simply add + 1 to upper-lower and use the < operator.
    if ((unsigned)(number-lower) <= (upper-lower))
        in_range(number);

With a typical, modern computer (i.e., anything using twos complement), the conversion to unsigned is really a nop -- just a change in how the same bits are viewed.

Note that in a typical case, you can pre-compute upper-lower outside a (presumed) loop, so that doesn't normally contribute any significant time. Along with reducing the number of branch instructions, this also (generally) improves branch prediction. In this case, the same branch is taken whether the number is below the bottom end or above the top end of the range.

As to how this works, the basic idea is pretty simple: a negative number, when viewed as an unsigned number, will be larger than anything that started out as a positive number.

In practice this method translates number and the interval to the point of origin and checks if number is in the interval [0, D], where D = upper - lower. If number below lower bound: negative, and if above upper bound: larger than D.

csdnceshi65
larry*wei a bit late, I know, but I think this particular trick is covered in detail in "Hacker's Delight" by Henry S. Warren (along with a lot of other cool low-level hacks).
3 年多之前 回复
csdnceshi72
谁还没个明天 Sorry, but no, not really.
6 年多之前 回复
csdnceshi73
喵-见缝插针 Do you happen to have a reference for the 'old trick' that I could cite?
6 年多之前 回复
csdnceshi50
三生石@ I wonder if it is possible to apply this trick in Java, because Java has no unsigned integers.
6 年多之前 回复
csdnceshi67
bug^君 Ah, now the @PsychoDad has updated the question, it's clear why this is faster. The real code has a side-effect in the comparison, which is why the compiler couldn't optimize the short-circuit away.
大约 7 年之前 回复
weixin_41568127
?yb? YOu really ought to put these details in your question (or edit them into the accepted answer as appropriate). Comments are a bad place for good information like this. The information gets lost, and sooner or later, it's just hard for other people to follow.
大约 7 年之前 回复
weixin_41568183
零零乙 the entire app is done with core graphics so at this point an OpenGL rewrite would be somewhat painful. Performance is actually decent even on my iPhone 4S with a 2048x2048 image.
大约 7 年之前 回复
csdnceshi59
ℙℕℤℝ Checking with gcc explorer, using && and using & produce exactly the same code, which is the short circuit (&&) method.
大约 7 年之前 回复
csdnceshi53
Lotus@ Sounds like something that should be done by the GPU...
大约 7 年之前 回复
csdnceshi55
~Onlooker A pastebin of the assembler in a hopefully more readable format.
大约 7 年之前 回复
csdnceshi77
狐狸.fox absolutely. I realize that the optimizer may end up producing comparable code, so I do see your point to an extent. I also see, however, that Jerry has some theoretical backing to his answer, which makes it (IMO) a good answer. I can see how it's not an obvious "good SO answer" though. I'm so conflicted
大约 7 年之前 回复
weixin_41568183
零零乙 For the curious the algorithm involved is a box blur that is restricting the blurred pixels to a circle. The inclusive check is checking if the current pixel is a point in a circle.
大约 7 年之前 回复
weixin_41568183
零零乙 I think this is the slower version: Ltmp1301: ldr r1, [sp, #172] @ 4-byte Reload ldr r1, [r1] cmp r0, r1 bls LBB44_32 mov r6, r0 b LBB44_33 LBB44_32: ldr r1, [sp, #188] @ 4-byte Reload adds r6, r0, #1 Ltmp1302: ldr r1, [r1] cmp r0, r1 bhs LBB44_36
大约 7 年之前 回复
weixin_41568183
零零乙 Yes they come from a struct with start, end and diff properties
大约 7 年之前 回复
csdnceshi70
笑故挽风 Looks like it, except number and upper-lower seem to come from a struct (or global).
大约 7 年之前 回复
weixin_41568183
零零乙 I think this is the omptimized code but I could be wrong, someone tell me if this looks way off: Ltmp1313: ldr r0, [sp, #176] @ 4-byte Reload ldr r1, [sp, #164] @ 4-byte Reload ldr r0, [r0] ldr r1, [r1] sub.w r0, r9, r0 cmp r0, r1 blo LBB44_30
大约 7 年之前 回复
weixin_41568183
零零乙 Found it in Xcode, since the file it's in is over 1000 lines now the tricky part will be finding the exact piece :)
大约 7 年之前 回复
csdnceshi70
笑故挽风 typically compilers support the -S option to produce an assembly file. I'd actually be interested in the assembly of the original (slow) code as well.
大约 7 年之前 回复
csdnceshi67
bug^君 To satisfy the curious amongst us, would you mind posting the assembler your compiler generated in each case?
大约 7 年之前 回复
csdnceshi52
妄徒之命 I would expect any compiler to optimize the code in that way. But if this is the case, then I can't see any reason why the code in the answer should be substantially faster than the code provided by the OP.
大约 7 年之前 回复
csdnceshi51
旧行李 even if testing shows that it's no different or even worse on most processors and compilers, if there's one where it's better then it's a worthwhile answer.
大约 7 年之前 回复
weixin_41568183
零零乙 WOW!!! This resulted in an order of magnitude improvement in my app for this specific line of code. By precomputing upper-lower my profiling went from 25% time of this function to less than 2%! Bottleneck is now addition and subtraction operations, but I think it might be good enough now :)
大约 7 年之前 回复
csdnceshi51
旧行李 an optimizer might make the substitution for you using the as-if rule since comparing integers has no side effects.
大约 7 年之前 回复
csdnceshi67
bug^君 jxh: As cool as this nugget is, I'm hesitant to upvote, because there's unfortunately nothing to suggest this is any faster in practice (until someone does a comparison of resulting assembler and profiling info). For all we know, the OP's compiler may render the OP's code with a single branch opcode...
大约 7 年之前 回复
csdnceshi52
妄徒之命 Additional branching is done due to short-circuiting? If this is the case, would lower <= x & x <= upper (instead of lower <= x && x <= upper) result in better performance as well?
大约 7 年之前 回复
csdnceshi55
~Onlooker Which is why questions that produce nuggets like these should also be rewarded with an upvote.
大约 7 年之前 回复
weixin_41568183
零零乙 upper-lower can be pre-calculated in my case as well since my data structure contains a start and end value, nice!
大约 7 年之前 回复
csdnceshi67
bug^君 They'll both be one cycle on any reasonable machine. What's expensive is the branch.
大约 7 年之前 回复
csdnceshi67
bug^君 Ah, I hadn't noticed that!
大约 7 年之前 回复
csdnceshi79
python小菜 Nice, but Im curious now. Thinking in machine cycles, a subtractor isn't more expensive than a comparison?
大约 7 年之前 回复
csdnceshi72
谁还没个明天 Yes, but he's said both are greater than 0, so it can't overflow (i.e, upper-lower < upper).
大约 7 年之前 回复
csdnceshi67
bug^君 Pretty neat. But this does rely on upper-lower not overflowing...
大约 7 年之前 回复

It depends on how many times you want to perform the test over the same data.

If you are performing the test a single time, there probably isn't a meaningful way to speed up the algorithm.

If you are doing this for a very finite set of values, then you could create a lookup table. Performing the indexing might be more expensive, but if you can fit the entire table in cache, then you can remove all branching from the code, which should speed things up.

For your data the lookup table would be 128^3 = 2,097,152. If you can control one of the three variables so you consider all instances where start = N at one time, then the size of the working set drops down to 128^2 = 16432 bytes, which should fit well in most modern caches.

You would still have to benchmark the actual code to see if a branchless lookup table is sufficiently faster than the obvious comparisons.

csdnceshi65
larry*wei I'll see if I can get around to trying this method and seeing how it goes. I'm planning on doing it with a bit vector per line where the bit will be set if the point is in the circle. Think that will be faster than a byte or int32 vs the bit masking?
大约 7 年之前 回复
csdnceshi67
bug^君 Correct. It would be a 3D lookup table: bool between[start][end][x]. If you know what your access pattern is going to look like (for example x is monotonically increasing) you can design the table to preserve locality even if the entire table doesn't fit in memory.
大约 7 年之前 回复
csdnceshi65
larry*wei So you would store some sort of lookup given a value, start and end and it would contain a BOOL telling you if it was in between?
大约 7 年之前 回复

It's rare to be able to do significant optimizations to code on such a small scale. Big performance gains come from observing and modifying the code from a higher level. You may be able to eliminate the need for the range test altogether, or only do O(n) of them instead of O(n^2). You may be able to re-order the tests so that one side of the inequality is always implied. Even if the algorithm is ideal, gains are more likely to come when you see how this code does the range test 10 million times and you find a way to batch them up and use SSE to do many tests in parallel.

csdnceshi71
Memor.の Despite the downvotes I stand by my answer: The generated assembly (see the pastebin link in a comment to the accepted answer) is pretty terrible for something in the inner loop of a pixel processing function. The accepted answer is a neat trick but its dramatic effect is far beyond what is reasonable to expect for eliminating a fraction of a branch per iteration. Some secondary effect is dominating, and I still expect that an attempt to optimize the whole process over this one test would leave the gains of clever range comparison in the dust.
大约 7 年之前 回复

This answer is to report on a testing done with the accepted answer. I performed a closed range test on a large vector of sorted random integer and to my surprise the basic method of ( low <= num && num <= high) is in fact faster than the accepted answer above! Test was done on HP Pavilion g6 (AMD A6-3400APU with 6GB ram. Here's the core code used for testing:

int num = rand();  // num to compare in consecutive ranges.
chrono::time_point<chrono::system_clock> start, end;
auto start = chrono::system_clock::now();

int inBetween1{ 0 };
for (int i = 1; i < MaxNum; ++i)
{
    if (randVec[i - 1] <= num && num <= randVec[i])
        ++inBetween1;
}
auto end = chrono::system_clock::now();
chrono::duration<double> elapsed_s1 = end - start;

compared with the following which is the accepted answer above:

int inBetween2{ 0 };
for (int i = 1; i < MaxNum; ++i)
{
    if (static_cast<unsigned>(num - randVec[i - 1]) <= (randVec[i] - randVec[i - 1]))
        ++inBetween2;
}

Pay attention that randVec is a sorted vector. For any size of MaxNum the first method beats the second one on my machine!

csdnceshi60
℡Wang Yan sorted in my test was only to make sure upper limit is not smaller than lower limit.
3 年多之前 回复
weixin_41568183
零零乙 My data is not sorted and my tests are on iPhone arm CPU. Your results with different data and CPU may differ.
3 年多之前 回复

Is it not possible to just perform a bitwise operation on the integer?

Since it has to be between 0 and 128, if the 8th bit is set (2^7) it is 128 or more. The edge case will be a pain, though, since you want an inclusive comparison.

csdnceshi60
℡Wang Yan Yeah, apparently I didn't think that through enough. Sorry.
大约 7 年之前 回复
csdnceshi55
~Onlooker This statement "Since it has to be between 0 and 128, if the 8th bit is set (2^7) it is 128 or more" is wrong. Consider 256.
大约 7 年之前 回复
csdnceshi61
derek5. He wants to know if x <= end, where end <= 128. Not x <= 128.
大约 7 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
确定整数是否位于具有已知值集的两个整数(包含)之间的最快方法

<div class="post-text" itemprop="text"> <p>Is there a faster way than <code>x &gt;= start &amp;&amp; x &lt;= end</code> in C or C++ to test if an integer is between two integers?</p> <p><em>UPDATE</em>: My specific platform is iOS. This is part of a box blur function that restricts pixels to a circle in a given square.</p> <p><em>UPDATE</em>: After trying the <a href="https://stackoverflow.com/a/17095534/1165522">accepted answer</a>, I got an order of magnitude speedup on the one line of code over doing it the normal <code>x &gt;= start &amp;&amp; x &lt;= end</code> way.</p> <p><em>UPDATE</em>: Here is the after and before code with assembler from XCode:</p> <p><strong>NEW WAY</strong></p> <pre><code>// diff = (end - start) + 1 #define POINT_IN_RANGE_AND_INCREMENT(p, range) ((p++ - range.start) &lt; range.diff) Ltmp1313: ldr r0, [sp, #176] @ 4-byte Reload ldr r1, [sp, #164] @ 4-byte Reload ldr r0, [r0] ldr r1, [r1] sub.w r0, r9, r0 cmp r0, r1 blo LBB44_30 </code></pre> <p><strong>OLD WAY</strong></p> <pre><code>#define POINT_IN_RANGE_AND_INCREMENT(p, range) (p &lt;= range.end &amp;&amp; p++ &gt;= range.start) Ltmp1301: ldr r1, [sp, #172] @ 4-byte Reload ldr r1, [r1] cmp r0, r1 bls LBB44_32 mov r6, r0 b LBB44_33 LBB44_32: ldr r1, [sp, #188] @ 4-byte Reload adds r6, r0, #1 Ltmp1302: ldr r1, [r1] cmp r0, r1 bhs LBB44_36 </code></pre> <p>Pretty amazing how reducing or eliminating branching can provide such a dramatic speed up.</p> </div> <p>转载于:https://stackoverflow.com/questions/17095324/fastest-way-to-determine-if-an-integer-is-between-two-integers-inclusive-with</p>

已知一个浮点数A,求它由哪两个整数B/C相除的值最接近,有相同值时要求B最小,有木有什么思路?

已知一个浮点数A(0<A<5),求它由哪两个整数B/C相除的值最接近,有相同值时要求B最小 例如: A=0.2 B=1 C=5

是判断两个正整数之间完数的个数,C语言数因子拆分的实现的方式

Problem Description 完数的定义:如果一个大于1的正整数的所有因子之和等于它的本身,则称这个数是完数,比如6,28都是完数:6=1+2+3;28=1+2+4+7+14。 本题的任务是判断两个正整数之间完数的个数。 Input 输入数据包含多行,第一行是一个正整数n,表示测试实例的个数,然后就是n个测试实例,每个实例占一行,由两个正整数num1和num2组成,(1<num1,num2<10000) 。 Output 对于每组测试数据,请输出num1和num2之间(包括num1和num2)存在的完数个数。 Sample Input 2 2 5 5 7 Sample Output 0 1

判断一个整数的平方根是否为整数的最快方法

<div class="post-text" itemprop="text"> <p>I'm looking for the fastest way to determine if a <code>long</code> value is a perfect square (i.e. its square root is another integer): </p> <ol> <li>I've done it the easy way, by using the built-in Math.sqrt() function, but I'm wondering if there is a way to do it faster by restricting yourself to integer-only domain.</li> <li>Maintaining a lookup table is impratical (since there are about 2<sup>31.5</sup> integers whose square is less than 2<sup>63</sup>).</li> </ol> <p>Here is the very simple and straightforward way I'm doing it now:</p> <pre><code>public final static boolean isPerfectSquare(long n) { if (n &lt; 0) return false; long tst = (long)(Math.sqrt(n) + 0.5); return tst*tst == n; } </code></pre> <hr> <p><i>Notes: I'm using this function in many <a href="http://projecteuler.net/" rel="noreferrer">Project Euler</a> problems. So no one else will ever have to maintain this code. And this kind of micro-optimization could actually make a difference, since part of the challenge is to do every algorithm in less than a minute, and this function will need to be called millions of times in some problems.</i></p> <hr> <p>A new solution posted by <a href="https://stackoverflow.com/users/3508/a-rex">A. Rex</a> has proven to be even faster. In a run over the first 1 billion integers, the solution only required 34% of the time that the original solution used. While the John Carmack hack is a little better for small values of <em>n</em>, the benefit compared to this solution is pretty small.</p> <p>Here is the A. Rex solution, converted to Java:</p> <pre><code>private final static boolean isPerfectSquare(long n) { // Quickfail if( n &lt; 0 || ((n&amp;2) != 0) || ((n &amp; 7) == 5) || ((n &amp; 11) == 8) ) return false; if( n == 0 ) return true; // Check mod 255 = 3 * 5 * 17, for fun long y = n; y = (y &amp; 0xffffffffL) + (y &gt;&gt; 32); y = (y &amp; 0xffffL) + (y &gt;&gt; 16); y = (y &amp; 0xffL) + ((y &gt;&gt; 8) &amp; 0xffL) + (y &gt;&gt; 16); if( bad255[(int)y] ) return false; // Divide out powers of 4 using binary search if((n &amp; 0xffffffffL) == 0) n &gt;&gt;= 32; if((n &amp; 0xffffL) == 0) n &gt;&gt;= 16; if((n &amp; 0xffL) == 0) n &gt;&gt;= 8; if((n &amp; 0xfL) == 0) n &gt;&gt;= 4; if((n &amp; 0x3L) == 0) n &gt;&gt;= 2; if((n &amp; 0x7L) != 1) return false; // Compute sqrt using something like Hensel's lemma long r, t, z; r = start[(int)((n &gt;&gt; 3) &amp; 0x3ffL)]; do { z = n - r * r; if( z == 0 ) return true; if( z &lt; 0 ) return false; t = z &amp; (-z); r += (z &amp; t) &gt;&gt; 1; if( r &gt; (t &gt;&gt; 1) ) r = t - r; } while( t &lt;= (1L &lt;&lt; 33) ); return false; } private static boolean[] bad255 = { false,false,true ,true ,false,true ,true ,true ,true ,false,true ,true ,true , true ,true ,false,false,true ,true ,false,true ,false,true ,true ,true ,false, true ,true ,true ,true ,false,true ,true ,true ,false,true ,false,true ,true , true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,false, true ,true ,true ,false,true ,true ,true ,true ,false,true ,true ,true ,false, true ,false,true ,true ,false,false,true ,true ,true ,true ,true ,false,true , true ,true ,true ,false,true ,true ,false,false,true ,true ,true ,true ,true , true ,true ,true ,false,true ,true ,true ,true ,true ,false,true ,true ,true , true ,true ,false,true ,true ,true ,true ,false,true ,true ,true ,false,true , true ,true ,true ,false,false,true ,true ,true ,true ,true ,true ,true ,true , true ,true ,true ,true ,true ,false,false,true ,true ,true ,true ,true ,true , true ,false,false,true ,true ,true ,true ,true ,false,true ,true ,false,true , true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true , false,true ,false,true ,true ,false,true ,true ,true ,true ,true ,true ,true , true ,true ,true ,true ,false,true ,true ,false,true ,true ,true ,true ,true , false,false,true ,true ,true ,true ,true ,true ,true ,false,false,true ,true , true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,false, true ,true ,true ,true ,false,true ,true ,true ,false,true ,true ,true ,true , false,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,false, true ,true ,true ,true ,true ,true ,true ,true ,false,false,true ,true ,false, true ,true ,true ,true ,false,true ,true ,true ,true ,true ,false,false,true , true ,false,true ,false,true ,true ,true ,false,true ,true ,true ,true ,false, true ,true ,true ,false,true ,false,true ,true ,true ,true ,true ,true ,true , true ,true ,true ,true ,true ,false,true ,false,true ,true ,true ,false,true , true ,true ,true ,false,true ,true ,true ,false,true ,false,true ,true ,false, false,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,false,true , true ,false,false,true ,true ,true ,true ,true ,true ,true ,true ,false,true , true ,true ,true ,true ,false,true ,true ,true ,true ,true ,false,true ,true , true ,true ,false,true ,true ,true ,false,true ,true ,true ,true ,false,false, true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true , false,false,true ,true ,true ,true ,true ,true ,true ,false,false,true ,true , true ,true ,true ,false,true ,true ,false,true ,true ,true ,true ,true ,true , true ,true ,true ,true ,true ,false,true ,true ,false,true ,false,true ,true , false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false, true ,true ,false,true ,true ,true ,true ,true ,false,false,true ,true ,true , true ,true ,true ,true ,false,false,true ,true ,true ,true ,true ,true ,true , true ,true ,true ,true ,true ,true ,false,false,true ,true ,true ,true ,false, true ,true ,true ,false,true ,true ,true ,true ,false,true ,true ,true ,true , true ,false,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true , true ,true ,true ,false,false }; private static int[] start = { 1,3,1769,5,1937,1741,7,1451,479,157,9,91,945,659,1817,11, 1983,707,1321,1211,1071,13,1479,405,415,1501,1609,741,15,339,1703,203, 129,1411,873,1669,17,1715,1145,1835,351,1251,887,1573,975,19,1127,395, 1855,1981,425,453,1105,653,327,21,287,93,713,1691,1935,301,551,587, 257,1277,23,763,1903,1075,1799,1877,223,1437,1783,859,1201,621,25,779, 1727,573,471,1979,815,1293,825,363,159,1315,183,27,241,941,601,971, 385,131,919,901,273,435,647,1493,95,29,1417,805,719,1261,1177,1163, 1599,835,1367,315,1361,1933,1977,747,31,1373,1079,1637,1679,1581,1753,1355, 513,1539,1815,1531,1647,205,505,1109,33,1379,521,1627,1457,1901,1767,1547, 1471,1853,1833,1349,559,1523,967,1131,97,35,1975,795,497,1875,1191,1739, 641,1149,1385,133,529,845,1657,725,161,1309,375,37,463,1555,615,1931, 1343,445,937,1083,1617,883,185,1515,225,1443,1225,869,1423,1235,39,1973, 769,259,489,1797,1391,1485,1287,341,289,99,1271,1701,1713,915,537,1781, 1215,963,41,581,303,243,1337,1899,353,1245,329,1563,753,595,1113,1589, 897,1667,407,635,785,1971,135,43,417,1507,1929,731,207,275,1689,1397, 1087,1725,855,1851,1873,397,1607,1813,481,163,567,101,1167,45,1831,1205, 1025,1021,1303,1029,1135,1331,1017,427,545,1181,1033,933,1969,365,1255,1013, 959,317,1751,187,47,1037,455,1429,609,1571,1463,1765,1009,685,679,821, 1153,387,1897,1403,1041,691,1927,811,673,227,137,1499,49,1005,103,629, 831,1091,1449,1477,1967,1677,697,1045,737,1117,1737,667,911,1325,473,437, 1281,1795,1001,261,879,51,775,1195,801,1635,759,165,1871,1645,1049,245, 703,1597,553,955,209,1779,1849,661,865,291,841,997,1265,1965,1625,53, 1409,893,105,1925,1297,589,377,1579,929,1053,1655,1829,305,1811,1895,139, 575,189,343,709,1711,1139,1095,277,993,1699,55,1435,655,1491,1319,331, 1537,515,791,507,623,1229,1529,1963,1057,355,1545,603,1615,1171,743,523, 447,1219,1239,1723,465,499,57,107,1121,989,951,229,1521,851,167,715, 1665,1923,1687,1157,1553,1869,1415,1749,1185,1763,649,1061,561,531,409,907, 319,1469,1961,59,1455,141,1209,491,1249,419,1847,1893,399,211,985,1099, 1793,765,1513,1275,367,1587,263,1365,1313,925,247,1371,1359,109,1561,1291, 191,61,1065,1605,721,781,1735,875,1377,1827,1353,539,1777,429,1959,1483, 1921,643,617,389,1809,947,889,981,1441,483,1143,293,817,749,1383,1675, 63,1347,169,827,1199,1421,583,1259,1505,861,457,1125,143,1069,807,1867, 2047,2045,279,2043,111,307,2041,597,1569,1891,2039,1957,1103,1389,231,2037, 65,1341,727,837,977,2035,569,1643,1633,547,439,1307,2033,1709,345,1845, 1919,637,1175,379,2031,333,903,213,1697,797,1161,475,1073,2029,921,1653, 193,67,1623,1595,943,1395,1721,2027,1761,1955,1335,357,113,1747,1497,1461, 1791,771,2025,1285,145,973,249,171,1825,611,265,1189,847,1427,2023,1269, 321,1475,1577,69,1233,755,1223,1685,1889,733,1865,2021,1807,1107,1447,1077, 1663,1917,1129,1147,1775,1613,1401,555,1953,2019,631,1243,1329,787,871,885, 449,1213,681,1733,687,115,71,1301,2017,675,969,411,369,467,295,693, 1535,509,233,517,401,1843,1543,939,2015,669,1527,421,591,147,281,501, 577,195,215,699,1489,525,1081,917,1951,2013,73,1253,1551,173,857,309, 1407,899,663,1915,1519,1203,391,1323,1887,739,1673,2011,1585,493,1433,117, 705,1603,1111,965,431,1165,1863,533,1823,605,823,1179,625,813,2009,75, 1279,1789,1559,251,657,563,761,1707,1759,1949,777,347,335,1133,1511,267, 833,1085,2007,1467,1745,1805,711,149,1695,803,1719,485,1295,1453,935,459, 1151,381,1641,1413,1263,77,1913,2005,1631,541,119,1317,1841,1773,359,651, 961,323,1193,197,175,1651,441,235,1567,1885,1481,1947,881,2003,217,843, 1023,1027,745,1019,913,717,1031,1621,1503,867,1015,1115,79,1683,793,1035, 1089,1731,297,1861,2001,1011,1593,619,1439,477,585,283,1039,1363,1369,1227, 895,1661,151,645,1007,1357,121,1237,1375,1821,1911,549,1999,1043,1945,1419, 1217,957,599,571,81,371,1351,1003,1311,931,311,1381,1137,723,1575,1611, 767,253,1047,1787,1169,1997,1273,853,1247,413,1289,1883,177,403,999,1803, 1345,451,1495,1093,1839,269,199,1387,1183,1757,1207,1051,783,83,423,1995, 639,1155,1943,123,751,1459,1671,469,1119,995,393,219,1743,237,153,1909, 1473,1859,1705,1339,337,909,953,1771,1055,349,1993,613,1393,557,729,1717, 511,1533,1257,1541,1425,819,519,85,991,1693,503,1445,433,877,1305,1525, 1601,829,809,325,1583,1549,1991,1941,927,1059,1097,1819,527,1197,1881,1333, 383,125,361,891,495,179,633,299,863,285,1399,987,1487,1517,1639,1141, 1729,579,87,1989,593,1907,839,1557,799,1629,201,155,1649,1837,1063,949, 255,1283,535,773,1681,461,1785,683,735,1123,1801,677,689,1939,487,757, 1857,1987,983,443,1327,1267,313,1173,671,221,695,1509,271,1619,89,565, 127,1405,1431,1659,239,1101,1159,1067,607,1565,905,1755,1231,1299,665,373, 1985,701,1879,1221,849,627,1465,789,543,1187,1591,923,1905,979,1241,181 }; </code></pre> <hr> <p>I've tried the different solutions presented below.</p> <ul> <li>After exhaustive testing, I found that adding <code>0.5</code> to the result of Math.sqrt() is not necessary, at least not on my machine.</li> <li>The <a href="https://en.wikipedia.org/wiki/Fast_inverse_square_root" rel="noreferrer">John Carmack hack</a> was faster, but it gave incorrect results starting at n=410881. However, as suggested by <a href="https://stackoverflow.com/users/38426/bobbyshaftoe">BobbyShaftoe</a>, we can use the Carmack hack for n &lt; 410881.</li> <li>Newton's method was a good bit slower than <code>Math.sqrt()</code>. This is probably because <code>Math.sqrt()</code> uses something similar to Newton's Method, but implemented in the hardware so it's much faster than in Java. Also, Newton's Method still required use of doubles.</li> <li>A modified Newton's method, which used a few tricks so that only integer math was involved, required some hacks to avoid overflow (I want this function to work with all positive 64-bit signed integers), and it was still slower than <code>Math.sqrt()</code>.</li> <li>Binary chop was even slower. This makes sense because the binary chop will on average require 16 passes to find the square root of a 64-bit number.</li> </ul> <p>The one suggestion which did show improvements was made by <a href="https://stackoverflow.com/users/25188/john-d-cook">John D. Cook</a>. You can observe that the last hex digit (i.e. the last 4 bits) of a perfect square must be 0, 1, 4, or 9. This means that 75% of numbers can be immediately eliminated as possible squares. Implementing this solution resulted in about a 50% reduction in runtime.</p> <p>Working from John's suggestion, I investigated properties of the last <em>n</em> bits of a perfect square. By analyzing the last 6 bits, I found that only 12 out of 64 values are possible for the last 6 bits. This means 81% of values can be eliminated without using any math. Implementing this solution gave an additional 8% reduction in runtime (compared to my original algorithm). Analyzing more than 6 bits results in a list of possible ending bits which is too large to be practical.</p> <p>Here is the code that I have used, which runs in 42% of the time required by the original algorithm (based on a run over the first 100 million integers). For values of <em>n</em> less than 410881, it runs in only 29% of the time required by the original algorithm.</p> <pre><code>private final static boolean isPerfectSquare(long n) { if (n &lt; 0) return false; switch((int)(n &amp; 0x3F)) { case 0x00: case 0x01: case 0x04: case 0x09: case 0x10: case 0x11: case 0x19: case 0x21: case 0x24: case 0x29: case 0x31: case 0x39: long sqrt; if(n &lt; 410881L) { //John Carmack hack, converted to Java. // See: http://www.codemaestro.com/reviews/9 int i; float x2, y; x2 = n * 0.5F; y = n; i = Float.floatToRawIntBits(y); i = 0x5f3759df - ( i &gt;&gt; 1 ); y = Float.intBitsToFloat(i); y = y * ( 1.5F - ( x2 * y * y ) ); sqrt = (long)(1.0F/y); } else { //Carmack hack gives incorrect answer for n &gt;= 410881. sqrt = (long)Math.sqrt(n); } return sqrt*sqrt == n; default: return false; } } </code></pre> <p><strong>Notes</strong>:</p> <ul> <li>According to John's tests, using <code>or</code> statements is faster in C++ than using a <code>switch</code>, but in Java and C# there appears to be no difference between <code>or</code> and <code>switch</code>.</li> <li>I also tried making a lookup table (as a private static array of 64 boolean values). Then instead of either switch or <code>or</code> statement, I would just say <code>if(lookup[(int)(n&amp;0x3F)]) { test } else return false;</code>. To my surprise, this was (just slightly) slower. <del>I'm not sure why.</del> This is because <a href="https://stackoverflow.com/questions/299079/why-is-this-code-with-several-or-statements-slightly-faster-than-using-a-lookup-t#299205">array bounds are checked in Java</a>. </li> </ul> </div> <p>转载于:https://stackoverflow.com/questions/295579/fastest-way-to-determine-if-an-integers-square-root-is-an-integer</p>

用C#判断一个整数是否为素数

输入整数N,判断N是否为素数,输出布尔值表示该整数是否为素数,然后输出小于N的所有素数 本人刚开始学习C#,只知道这个要用一个二重循环来做,现在已经写好一个循环,代码如下 int m, i, count = 0; Console.WriteLine("请输入一个整数:"); m = Convert.ToInt32(Console.ReadLine()); for (i = 2; i <= Math.Sqrt(m); i++) { if (m % i == 0) { count = 1; continue; } } if(count==0) { Console.WriteLine("yes!"); } else { Console.WriteLine("No!"); } Console.ReadLine(); 求高手指点接下来应该怎么做

有n个正整数,对每一个正整数有两种操作 - 将该整数乘以2 - 将该整数除2向下取余 每一个整数可任意选取一个操作,每一次操作算一步。 对n个整数进行如上操作 问:最少需要多少步,可以使所有整数的值相等?

有n个正整数,对每一个正整数有两种操作 - 将该整数乘以2 - 将该整数除2向下取余 每一个整数可任意选取一个操作,每一次操作算一步。 对n个整数进行如上操作 问:最少需要多少步,可以使所有整数的值相等? 输入: 第一行输入一个正整数n。 第二行输入n个正整数。 输出: 输出一个整数,该整数表示最少需要多少步,可以使所有整数值相等。

C++ 两数之间的所有整数

#include <iostream> using namespace std; int main() { int i = 1; while (i == 1) { int num1, num2; cout << "Please input two numbers" << endl; cin >> num1 >> num2; if (num1 <= num2) { int i = num1; while (i >= num1 && i <= num2)//&&逻辑与 只要一个不为真就是假的; { cout << i << endl; i++; } } else { int i = num2; while (i >= num2 && i <= num1) { //这里用到了判断语句if else 判断 num1是大于num2,还是num1小于num2的判断语句 cout << i << endl; i++; } } } return 0; } 麻烦用for,来改写这段代码 麻烦有知道的 帮忙改写一下

用VBS脚本 任意输入两个整数,求这两个整数之间所有整数的和

用VBS脚本 写出任意输入两个整数,求这两个整数之间所有整数的和 没事自学写着玩的,折腾了一晚上,写不出来,大神帮帮忙吧

Java语言怎么判断一个浮点数是不是一个整数呢?怎么判断浮点数的小数是0

Java语言怎么判断一个浮点数是不是一个整数呢?怎么判断浮点数的小数是0

VBS脚本 任意输入两个整数,求两个整数之间所有整数的和

VBS脚本 任意输入两个整数,求两个整数之间所有整数的和 感谢!我自学玩,折腾了一晚上,

判断一个整数是否为一些数的阶乘之和

Description 给你一个非负数整数n,判断n是不是一些数(这些数不允许重复使用,且为正数)的阶乘之和,如9=1!+2!+3!,如果是,则输出Yes,否则输出No; Input 第一行有一个整数0<m<100,表示有m组测试数据; 每组测试数据有一个正整数n<1000000; Output 如果符合条件,输出Yes,否则输出No; Sample Input 2 9 10 Sample Output Yes No ----------------------------------------- 我的代码提交后显示50%错误 #include<stdio.h> int a[12]={0,1,2,6,24,120,720,5040,40320,362880}; int res(int m); int main() { int m,n; scanf("%d",&n); while(n--) { scanf("%d",&m); { if(res(m)==1) { printf("Yes\n"); } else { printf("No\n"); } } } return 0; } int res(int m) { int i=9; for(i=9;i>0;i--) { if(m==0) { break; } else if(m>=a[i]) { m=m-a[i]; } } if(m==0) return 1; else return 0; }

c++中如何输入4个数然后另一个数值为起始值一个数值为终止值,两个除数整除

# 4.编写程序计算能同时被两个或者三个整数整除的数值。选择两个整数整除,输入四个数值,一个起始数值,一个终止数值,两个除数整数,输出两个数值之间的所有能同时被两个整数整除的数值, 每行输出4个数;或者选择三个整数整除,输入五个数值,一个起始数值,一个终止数值,三个除数整数,输出两个数值之间的所有能同时被三个整数整除的数值, 每行输出4个数;?。 比如,输入 起始数值:1 终止数值:20 选择两个整数整除 输入两个除数整数:2,3 选择两个整数整除输出:6 12

给定一个整数型的数组,和一个特定的整数值。编程求出数组中任两个元素的差等于给定整数值的值对?

给定一个整数型的数组,和一个特定的整数值。编程求出数组中任两个元素的差等于给定整数值的值对? 如题,自己初步想了下,貌似是一道关于排列组合的问题,不知道有没有更完美的解决方法? 请赐教

给定从1到N,N个整数,每个整数给两次,求出2N个元素的所有组合,满足以下条件:1.从1-N的每个整数必须出现两次2.同一整数之间的距离就是该整数的值

用python实现以下程序 给定从1到N,N个整数,每个整数给两次,求出2N个元素的所有组合,满足以下条件: 1.从1-N的每个整数必须出现两次 2.同一整数之间的距离就是该整数的值。 问题如下 1.设计状态空间树,描述想法和思路,通过回溯来解决这个问题、 2.在Python中以函数的形式实现该算法: def twice_distance(n): ![图片说明](https://img-ask.csdn.net/upload/202006/13/1592060515_430218.png)

判断一个整数是不是素数,我这样子调用函数,为什么最后得到的都是“不是素数”

#include<stdio.h> #include<math.h> int main() { int n,f,i; int s(int n); printf("请输入一个整数:\n"); scanf("%d",&n); { if(i<=sqrt(n)) printf("该整数不是素数\n"); else printf("该整数是素数\n"); } return 0; } int s(int) {int temp,i,n; for(i=2;i<=sqrt(n);i++) if(n%i==0); temp=n; return (temp); }

输出判断两个整数之间的所有数字的和是否大于给定的一个整数,采用C语言解决

Problem Description As we all know, in the computer science, an integer A is in the range of 32-signed integer, which means the integer A is between -2^31 and (2^31)-1 (inclusive), and A is a 64-signed integer, which means A is between -2^63 and (2^63)-1(inclusive). Now we give the K-signed range, and two K-signed integers A and B, you should check whether the sum of A and B is beyond the range of K-signed integer or not. Input There will be many cases to calculate. In each case, there comes the integer K (2<=K<=64) first in a single line. Then following the line, there is another single line which has two K-signed integers A and B. Output For each case, you should estimate whether the sum is beyond the range. If exceeded, print “Yes”, otherwise “WaHaHa”. Sample Input 32 100 100 Sample Output WaHaHa

我想知道该问题的答案:给定从1到N,N个整数,每个整数给两次,求出2N个元素的所有组合,满足以下条件:1.从1-N的每个整数必须出现两次2.同一整数之间的距离就是该整数的值?

用python实现以下程序 给定从1到N,N个整数,每个整数给两次,求出2N个元素的所有组合,满足以下条件: 1.从1-N的每个整数必须出现两次 2.同一整数之间的距离就是该整数的值。 问题如下 1.设计状态空间树,描述想法和思路,通过回溯来解决这个问题、 2.在Python中以函数的形式实现该算法: def twice_distance(n):![图片说明](https://img-ask.csdn.net/upload/202006/13/1592062789_66713.png) 希望有人能把解决该题的方法的python源码给出来

用java 写一个方法,能够判断任意整数是否是素数

用java代码写一个方法,能够判断任意整数是否是素数。。。。。。。。。

MySQL 8.0.19安装教程(windows 64位)

话不多说直接开干 目录 1-先去官网下载点击的MySQL的下载​ 2-配置初始化的my.ini文件的文件 3-初始化MySQL 4-安装MySQL服务 + 启动MySQL 服务 5-连接MySQL + 修改密码 先去官网下载点击的MySQL的下载 下载完成后解压 解压完是这个样子 配置初始化的my.ini文件的文件 ...

Python+OpenCV计算机视觉

Python+OpenCV计算机视觉系统全面的介绍。

Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂

navicat(内含激活码)

navicat支持mysql的可视化操作,内涵激活码,不用再忍受弹框的痛苦。

HTML期末大作业

这是我自己做的HTML期末大作业,花了很多时间,稍加修改就可以作为自己的作业了,而且也可以作为学习参考

150讲轻松搞定Python网络爬虫

【为什么学爬虫?】 &nbsp; &nbsp; &nbsp; &nbsp;1、爬虫入手容易,但是深入较难,如何写出高效率的爬虫,如何写出灵活性高可扩展的爬虫都是一项技术活。另外在爬虫过程中,经常容易遇到被反爬虫,比如字体反爬、IP识别、验证码等,如何层层攻克难点拿到想要的数据,这门课程,你都能学到! &nbsp; &nbsp; &nbsp; &nbsp;2、如果是作为一个其他行业的开发者,比如app开发,web开发,学习爬虫能让你加强对技术的认知,能够开发出更加安全的软件和网站 【课程设计】 一个完整的爬虫程序,无论大小,总体来说可以分成三个步骤,分别是: 网络请求:模拟浏览器的行为从网上抓取数据。 数据解析:将请求下来的数据进行过滤,提取我们想要的数据。 数据存储:将提取到的数据存储到硬盘或者内存中。比如用mysql数据库或者redis等。 那么本课程也是按照这几个步骤循序渐进的进行讲解,带领学生完整的掌握每个步骤的技术。另外,因为爬虫的多样性,在爬取的过程中可能会发生被反爬、效率低下等。因此我们又增加了两个章节用来提高爬虫程序的灵活性,分别是: 爬虫进阶:包括IP代理,多线程爬虫,图形验证码识别、JS加密解密、动态网页爬虫、字体反爬识别等。 Scrapy和分布式爬虫:Scrapy框架、Scrapy-redis组件、分布式爬虫等。 通过爬虫进阶的知识点我们能应付大量的反爬网站,而Scrapy框架作为一个专业的爬虫框架,使用他可以快速提高我们编写爬虫程序的效率和速度。另外如果一台机器不能满足你的需求,我们可以用分布式爬虫让多台机器帮助你快速爬取数据。 &nbsp; 从基础爬虫到商业化应用爬虫,本套课程满足您的所有需求! 【课程服务】 专属付费社群+每周三讨论会+1v1答疑

三个项目玩转深度学习(附1G源码)

从事大数据与人工智能开发与实践约十年,钱老师亲自见证了大数据行业的发展与人工智能的从冷到热。事实证明,计算机技术的发展,算力突破,海量数据,机器人技术等,开启了第四次工业革命的序章。深度学习图像分类一直是人工智能的经典任务,是智慧零售、安防、无人驾驶等机器视觉应用领域的核心技术之一,掌握图像分类技术是机器视觉学习的重中之重。针对现有线上学习的特点与实际需求,我们开发了人工智能案例实战系列课程。打造:以项目案例实践为驱动的课程学习方式,覆盖了智能零售,智慧交通等常见领域,通过基础学习、项目案例实践、社群答疑,三维立体的方式,打造最好的学习效果。

基于STM32的电子时钟设计

时钟功能 还有闹钟功能,温湿度功能,整点报时功能 你值得拥有

学生成绩管理系统(PHP + MYSQL)

做的是数据库课程设计,使用的php + MySQL,本来是黄金搭配也就没啥说的,推荐使用wamp服务器,里面有详细的使用说明,带有界面的啊!呵呵 不行的话,可以给我留言!

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

程序员的兼职技能课

获取讲师答疑方式: 在付费视频第一节(触摸命令_ALL)片头有二维码及加群流程介绍 限时福利 原价99元,今日仅需39元!购课添加小助手(微信号:itxy41)按提示还可领取价值800元的编程大礼包! 讲师介绍: 苏奕嘉&nbsp;前阿里UC项目工程师 脚本开发平台官方认证满级(六级)开发者。 我将如何教会你通过【定制脚本】赚到你人生的第一桶金? 零基础程序定制脚本开发课程,是完全针对零脚本开发经验的小白而设计,课程内容共分为3大阶段: ①前期将带你掌握Q开发语言和界面交互开发能力; ②中期通过实战来制作有具体需求的定制脚本; ③后期将解锁脚本的更高阶玩法,打通任督二脉; ④应用定制脚本合法赚取额外收入的完整经验分享,带你通过程序定制脚本开发这项副业,赚取到你的第一桶金!

实用主义学Python(小白也容易上手的Python实用案例)

原价169,限时立减100元! 系统掌握Python核心语法16点,轻松应对工作中80%以上的Python使用场景! 69元=72讲+源码+社群答疑+讲师社群分享会&nbsp; 【哪些人适合学习这门课程?】 1)大学生,平时只学习了Python理论,并未接触Python实战问题; 2)对Python实用技能掌握薄弱的人,自动化、爬虫、数据分析能让你快速提高工作效率; 3)想学习新技术,如:人工智能、机器学习、深度学习等,这门课程是你的必修课程; 4)想修炼更好的编程内功,优秀的工程师肯定不能只会一门语言,Python语言功能强大、使用高效、简单易学。 【超实用技能】 从零开始 自动生成工作周报 职场升级 豆瓣电影数据爬取 实用案例 奥运冠军数据分析 自动化办公:通过Python自动化分析Excel数据并自动操作Word文档,最终获得一份基于Excel表格的数据分析报告。 豆瓣电影爬虫:通过Python自动爬取豆瓣电影信息并将电影图片保存到本地。 奥运会数据分析实战 简介:通过Python分析120年间奥运会的数据,从不同角度入手分析,从而得出一些有趣的结论。 【超人气老师】 二两 中国人工智能协会高级会员 生成对抗神经网络研究者 《深入浅出生成对抗网络:原理剖析与TensorFlow实现》一书作者 阿里云大学云学院导师 前大型游戏公司后端工程师 【超丰富实用案例】 0)图片背景去除案例 1)自动生成工作周报案例 2)豆瓣电影数据爬取案例 3)奥运会数据分析案例 4)自动处理邮件案例 5)github信息爬取/更新提醒案例 6)B站百大UP信息爬取与分析案例 7)构建自己的论文网站案例

Java8零基础入门视频教程

这门课程基于主流的java8平台,由浅入深的详细讲解了java SE的开发技术,可以使java方向的入门学员,快速扎实的掌握java开发技术!

Python数据挖掘简易入门

&nbsp; &nbsp; &nbsp; &nbsp; 本课程为Python数据挖掘方向的入门课程,课程主要以真实数据为基础,详细介绍数据挖掘入门的流程和使用Python实现pandas与numpy在数据挖掘方向的运用,并深入学习如何运用scikit-learn调用常用的数据挖掘算法解决数据挖掘问题,为进一步深入学习数据挖掘打下扎实的基础。

零基础学C#编程—C#从小白到大咖

本课程从初学者角度出发,提供了C#从入门到成为程序开发高手所需要掌握的各方面知识和技术。 【课程特点】 1 由浅入深,编排合理; 2 视频讲解,精彩详尽; 3 丰富实例,轻松易学; 4 每章总结配有难点解析文档。 15大章节,228课时,1756分钟与你一同进步!

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

多功能数字钟.zip

利用数字电子计数知识设计并制作的数字电子钟(含multisim仿真),该数字钟具有显示星期、24小时制时间、闹铃、整点报时、时间校准功能

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

想学好JAVA必须要报两万的培训班吗? Java大神勿入 如果你: 零基础想学JAVA却不知道从何入手 看了一堆书和视频却还是连JAVA的环境都搭建不起来 囊中羞涩面对两万起的JAVA培训班不忍直视 在职没有每天大块的时间专门学习JAVA 那么恭喜你找到组织了,在这里有: 1. 一群志同道合立志学好JAVA的同学一起学习讨论JAVA 2. 灵活机动的学习时间完成特定学习任务+每日编程实战练习 3. 热心助人的助教和讲师及时帮你解决问题,不按时完成作业小心助教老师的家访哦 上一张图看看前辈的感悟: &nbsp; &nbsp; 大家一定迫不及待想知道什么是极简JAVA学习营了吧,下面就来给大家说道说道: 什么是极简JAVA学习营? 1. 针对Java小白或者初级Java学习者; 2. 利用9天时间,每天1个小时时间; 3.通过 每日作业 / 组队PK / 助教答疑 / 实战编程 / 项目答辩 / 社群讨论 / 趣味知识抢答等方式让学员爱上学习编程 , 最终实现能独立开发一个基于控制台的‘库存管理系统’ 的学习模式 极简JAVA学习营是怎么学习的? &nbsp; 如何报名? 只要购买了极简JAVA一:JAVA入门就算报名成功! &nbsp;本期为第四期极简JAVA学习营,我们来看看往期学员的学习状态: 作业看这里~ &nbsp; 助教的作业报告是不是很专业 不交作业打屁屁 助教答疑是不是很用心 &nbsp; 有奖抢答大家玩的很嗨啊 &nbsp; &nbsp; 项目答辩终于开始啦 &nbsp; 优秀者的获奖感言 &nbsp; 这是答辩项目的效果 &nbsp; &nbsp; 这么细致的服务,这么好的氛围,这样的学习效果,需要多少钱呢? 不要1999,不要199,不要99,只要9.9 是的你没听错,只要9.9以上所有就都属于你了 如果你: 1、&nbsp;想学JAVA没有基础 2、&nbsp;想学JAVA没有整块的时间 3、&nbsp;想学JAVA没有足够的预算 还等什么?赶紧报名吧,抓紧抢位,本期只招300人,错过只有等时间待定的下一期了 &nbsp; 报名请加小助手微信:eduxy-1 &nbsp; &nbsp;

Python可以这样学(第一季:Python内功修炼)

董付国系列教材《Python程序设计基础》、《Python程序设计(第2版)》、《Python可以这样学》配套视频,讲解Python 3.5.x和3.6.x语法、内置对象用法、选择与循环以及函数设计与使用、lambda表达式用法、字符串与正则表达式应用、面向对象编程、文本文件与二进制文件操作、目录操作与系统运维、异常处理结构。

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

机器学习实战系列套餐(必备基础+经典算法+案例实战)

机器学习实战系列套餐以实战为出发点,帮助同学们快速掌握机器学习领域必备经典算法原理并结合Python工具包进行实战应用。建议学习顺序:1.Python必备工具包:掌握实战工具 2.机器学习算法与实战应用:数学原理与应用方法都是必备技能 3.数据挖掘实战:通过真实数据集进行项目实战。按照下列课程顺序学习即可! 课程风格通俗易懂,用最接地气的方式带领大家轻松进军机器学习!提供所有课程代码,PPT与实战数据,有任何问题欢迎随时与我讨论。

Java面试题大全(2020版)

发现网上很多Java面试题都没有答案,所以花了很长时间搜集整理出来了这套Java面试题大全,希望对大家有帮助哈~ 本套Java面试题大全,全的不能再全,哈哈~ 一、Java 基础 1. JDK 和 JRE 有什么区别? JDK:Java Development Kit 的简称,java 开发工具包,提供了 java 的开发环境和运行环境。 JRE:Java Runtime Environ...

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

深度学习原理+项目实战+算法详解+主流框架(套餐)

深度学习系列课程从深度学习基础知识点开始讲解一步步进入神经网络的世界再到卷积和递归神经网络,详解各大经典网络架构。实战部分选择当下最火爆深度学习框架PyTorch与Tensorflow/Keras,全程实战演示框架核心使用与建模方法。项目实战部分选择计算机视觉与自然语言处理领域经典项目,从零开始详解算法原理,debug模式逐行代码解读。适合准备就业和转行的同学们加入学习! 建议按照下列课程顺序来进行学习 (1)掌握深度学习必备经典网络架构 (2)深度框架实战方法 (3)计算机视觉与自然语言处理项目实战。(按照课程排列顺序即可)

HoloLens2开发入门教程

本课程为HoloLens2开发入门教程,讲解部署开发环境,安装VS2019,Unity版本,Windows SDK,创建Unity项目,讲解如何使用MRTK,编辑器模拟手势交互,打包VS工程并编译部署应用到HoloLens上等。

几率大的Redis面试题(含答案)

本文的面试题如下: Redis 持久化机制 缓存雪崩、缓存穿透、缓存预热、缓存更新、缓存降级等问题 热点数据和冷数据是什么 Memcache与Redis的区别都有哪些? 单线程的redis为什么这么快 redis的数据类型,以及每种数据类型的使用场景,Redis 内部结构 redis的过期策略以及内存淘汰机制【~】 Redis 为什么是单线程的,优点 如何解决redis的并发竞争key问题 Red...

MFC一站式终极全套课程包

该套餐共包含从C小白到C++到MFC的全部课程,整套学下来绝对成为一名C++大牛!!!

【数据结构与算法综合实验】欢乐连连看(C++ & MFC)案例

这是武汉理工大学计算机学院数据结构与算法综合实验课程的第三次项目:欢乐连连看(C++ & MFC)迭代开发代码。运行环境:VS2017。已经实现功能:开始游戏、消子、判断胜负、提示、重排、计时、帮助。

YOLOv3目标检测实战:训练自己的数据集

YOLOv3是一种基于深度学习的端到端实时目标检测方法,以速度快见长。本课程将手把手地教大家使用labelImg标注和使用YOLOv3训练自己的数据集。课程分为三个小项目:足球目标检测(单目标检测)、梅西目标检测(单目标检测)、足球和梅西同时目标检测(两目标检测)。 本课程的YOLOv3使用Darknet,在Ubuntu系统上做项目演示。包括:安装Darknet、给自己的数据集打标签、整理自己的数据集、修改配置文件、训练自己的数据集、测试训练出的网络模型、性能统计(mAP计算和画出PR曲线)和先验框聚类。 Darknet是使用C语言实现的轻型开源深度学习框架,依赖少,可移植性好,值得深入探究。 除本课程《YOLOv3目标检测实战:训练自己的数据集》外,本人推出了有关YOLOv3目标检测的系列课程,请持续关注该系列的其它课程视频,包括: 《YOLOv3目标检测实战:交通标志识别》 《YOLOv3目标检测:原理与源码解析》 《YOLOv3目标检测:网络模型改进方法》 敬请关注并选择学习!

u-boot-2015.07.tar.bz2

uboot-2015-07最新代码,喜欢的朋友请拿去

php+mysql学生成绩管理系统

学生成绩管理系统,分三个模块:学生,教师和管理员。 管理员模块:负责学生、老师信息的增删改;发布课程信息的增删改,以便让学生选课;审核老师提交的学生成绩并且打印成绩存档;按照课号查询每个课号的学生成绩

相关热词 c#跨线程停止timer c#批量写入sql数据库 c# 自动安装浏览器 c#语言基础考试题 c# 偏移量打印是什么 c# 绘制曲线图 c#框体中的退出函数 c# 按钮透明背景 c# idl 混编出错 c#在位置0处没有任何行
立即提问