Tag:Single digit
-
Time:2021-4-7
Narcissus number:A three digit integer, the sum of cubes of number, ten and hundred is equal to the integer (example: 153 = 1 * 1 * 1 + 5 * 5 * 5 + 3 * 3) Step idea:1. Loop through in turn, output all three digits, rounding2. Set condition judgment3. Store output to array […]
-
Time:2021-3-31
Title Requirements: Idea 1 (converting STR to list) First judge whether the number is less than 0, and return false if it is less than 0 Judge whether the number is less than 10. If it is less than 10, return true, because the single digit is palindrome If the above two items do not […]
-
Time:2021-2-12
(1) Find the sum of all numbers within 100 divisible by 3 and 7 /*Step: use variable to store target number accumulation sum For sets the body of the loop If setting meets the condition*/ var sum = 0 for (var i = 1; i <= 100; i++) { if (i % 3 == 0 […]
-
Time:2020-6-6
<?php /* *Description *Given a positive integer a, find the smallest positive integer B whose number is multiplied by A. *If there is no answer, or the answer exceeds the range of 32-bit signed integer, return 0. * * */ function factorization(int $input) { //Each of its numbers multiplied by a equals a, //So the […]
-
Time:2020-4-10
Recursive case Recursive case: find the sum of the numbers in each digit of a number: 123 — > 6 — – 1 + 2 + 3 //Recursive case: find the sum of the numbers in each digit of a number: 123 — > 6 — – 1 + 2 + 3 function […]
-
Time:2020-3-11
I. circulation Input a number and output several digits #include int main() { int x; int n = 0; scanf(“%d” , &x); n++; x /= 10; while(x > 0){ n++; x /= 10; } printf(“%d\n”,n); return 0; } 2、 While loop The circulatory body should have the opportunity to change the conditions and avoid the […]
-
Time:2020-1-30
1. Mobile number var reg = /^1[3|4|5|6|7|8|9][0-9]{9}$/; 2. bank card function bankIdCheck(bankno){ Var lastnum = Bankno. Substr (Bankno. Length-1,1); // take the last bit (compare with Luhn) Var first15num = Bankno. Substr (0, Bankno. Length-1); // first 15 or 18 bits var newArr=new Array(); For (VaR I = first15num. Length-1; I > – 1; I […]