1. scanf ("% s", S );
// For (I = 0; I <11; I ++)
// Scanf ("% d", s [I]);
When entering a number, each number must be separated by a space before the computer can recognize and distinguish.
If 11 consecutive numbers are input, the computer considers them as a number.
Only 1 8 3 3 6 8 6 3 0 9 9 can the computer think that this is 11
Therefore, use a string
2. If the question provides a mathematical formula, ask you to calculate the value of nth item.
For a mathematics that provides an arithmetic formula, timeout and overmemory cannot be avoided without optimization.
This question is obviously a regular-looking question, that is, there is a circular section in the solution of this question.
3. Log Functions
1> function log is based on E, and log10 is based on 10.
2> double log10 (Double X)
That is, the number required is double, and the return value is double.
3> # include <math. h>
4> it can be used to calculate the number of digits of the number X.
4. Int I, J;
Double L;
L = (I * I + J * j + M)/(I * j * 1.0 );
// Divide the integer by the integer, and the result is always an integer, even if the type on the left side is double
// If you want to get a decimal number, you need to convert a certain data in the right side * 1.0 to double type.
5. memset (S, 0, sizeof (s ));
Initializes array s to 0, which is correct
To initialize the array s to 1, use memset (s, 1, sizeof (s); this write is incorrect, because the memset function assigns values by byte.
To initialize the array s to 1, you can only use the for loop or while loop.
6. s [0] = 1, s [1] = 5, s [2] =-1, s [N] = 8;
Fast sorting of S,
Qsort (S, N, sizeof (s [0]), CMP); --- sort from S [0]
If you want to sort data from S [1], how can you write it?
Qsort (S + 1, n-1, sizeof (s [0]), CMP); --- S is not only the array name, but also the first address of the array to be sorted.
--- N is the number of times to be sorted
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service