原题: A perfect power is a classification of positive integers: In mathematics, a perfect power is a positive integer that can be expressed as an integer power of another positive integer. More formally, n is a perfect power if there exist natural numb…
本文为第八部分,目录请参阅概述部分:http://www.cnblogs.com/harrywong/p/cpp-rvalue-references-explained-introduction.html. Perfect Forwarding(完美转发):解决方案 对右值引用的两个规则中的第一个也同样影响了旧式的左值引用.回想在pre-11 C++时,对一个引用取引用是是不被允许的,比如A& &会导致一个编译器错误.相比之下,在C++11中,引入了如下所示的引用折叠规则(referenc…
题目: When you sign up for an account somewhere, some websites do not actually store your password in their databases. Instead, they will transform your password into something else using a cryptographic hashing algorithm. After the password is transfo…
题目: Complete the function which takes two arguments and returns all numbers which are divisible by the given divisor. First argument is an array of numbers and the second is the divisor. Example divisible_by([1, 2, 3, 4, 5, 6], 2) == [2, 4, 6] 解题方法:…
题目: Summation Write a program that finds the summation of every number from 1 to num. The number will always be a positive integer greater than 0. For example: summation(2) -> 3 1 + 2 summation(8) -> 36 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 解题方法: 很简单的题目: de…
题目: Consider an array of sheep where some sheep may be missing from their place. We need a function that counts the number of sheep present in the array (true means present). For example, [True, True, True, False, True, True, True, True , True, False…
题目: In this simple exercise, you will create a program that will take two lists of integers, a and b. Each list will consist of 3 positive integers above 0, representing the dimensions of cuboids a and b. You must find the difference of the cuboids'…
题目: Create a method that takes an array/list as an input, and outputs the index at which the sole odd number is located. This method should work with arrays with negative numbers. If there are no odd numbers in the array, then the method should outpu…
题目: Complete the square sum function so that it squares each number passed into it and then sums the results together. For example, for [1, 2, 2] it should return 9 because 1^2 + 2^2 + 2^2 = 9. 解题方法:(再想想可能就出来了) def square_sum(numbers): return sum(map…
题目: Scenario Now that the competition gets tough it will Sort out the men from the boys . Men are the Even numbers and Boys are the odd   Task Given an array/list [] of n integers , Separate The even numbers from the odds , or Separate the men from t…