Third job Reading program signed 64-bit integer data type

Source: Internet
Author: User

This is a C + + program,,, the forehead, looked at the headache (amount, to tell the truth, because in the middle more than a year did not go to school, plus the beginning also learned very general, read tired) But what things slowly always better

Question one:

For:

First Int64 I is a signed 64-bit integer data type, the number I range is very large -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (+9,223,372,036,854,775,807) .... I mean the number of times that the program has encountered this kind of situation in the university for so many years

This shows that the school of things and the actual after all is still a big gap

And look at the for loop.

for (int j = 0; (J < RG. Length) && (hit <=2); J + +)
{
if ((i% rg[j])! = 0)
{
hit++;
if (hit = = 1)
{
Hit1 = j;
}
else if (hit = = 2)
{
Hit2 = j;
}
Else
Break
}

This is the process when the program goes to find a number, if a number can make the number in the RG array cannot be complete, then mark, up to two times

After the

if (hit = = 2) && (HIT1+1==HIT2))
{
Console.WriteLine ("Found {0}", i);
}

Indicates that if the number of two occurrences of an integer that is not divisible in the RG array is found in the execution process, then the output number

Question Two

A: First, as the first judgment, because I range is large enough, then the bold prediction of this number must exist, just need time to find it.

But honestly, I think the strange place is here, and I'm not quite sure how the I value in that for loop gets

That is when the beginning of childhood, then 2 is already satisfied, because in the array of the second and the third number than he is larger, can not be the whole, and hit==2,, that does not directly result,

Because from the program, there is such a situation: the second and the third number can not put I out, the program will not continue to execute,, there is no way to judge the fourth fifth number of the following is not to divide I

Well, of course, there may be no understanding at all,,,,

If the following is to be fully executed, it is required to be in the array of two consecutive numbers to complete the other 28 can be the whole, that is, it is all the number decomposition factor, in how to calculate, but the specific number is how much,,, the amount, it really does not count. But because the array is 2 to 31, so this number is the largest and 2x3x4x5.........x30x31 certainly less than int64, so there must be

Question 3

A: Well, because the number is how much I don't know, so this question is not to mention,,,

Question 4

A: The first few questions can probably know the direction, this question,,,, completely do not know

Third-time job reader signed 64-bit integer data type

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.