除法运算没有给出正确的结果
Division operation not giving the right result
我对这个操作有问题,它并没有真正给出正确的结果。
结果在终端上是60216,但应该是563376.
int a = 8536;
int b = 563376;
int d = 8536;
unsigned long long int k = (a*b);
cout << k/d << endl;
到处都需要long long
long long int a = 8536;
long long int b = 563376;
long long int d = 8536;
unsigned long long int k = (a * b);
std::cout << k / d << std::endl;
请注意,这与除法无关。这个
int a = 8536;
int b = 563376;
unsigned long long int k = (a * b);
std::cout << k << std::endl;
也答错了
我对这个操作有问题,它并没有真正给出正确的结果。 结果在终端上是60216,但应该是563376.
int a = 8536;
int b = 563376;
int d = 8536;
unsigned long long int k = (a*b);
cout << k/d << endl;
到处都需要long long
long long int a = 8536;
long long int b = 563376;
long long int d = 8536;
unsigned long long int k = (a * b);
std::cout << k / d << std::endl;
请注意,这与除法无关。这个
int a = 8536;
int b = 563376;
unsigned long long int k = (a * b);
std::cout << k << std::endl;
也答错了