if:
either is long double other is promoted > long double
either is double other is promoted > double
either is float other is promoted > float
either is long long unsigned int other is promoted > long long unsigned int
either is long long int other is promoted > long long int
either is long unsigned int other is promoted > long unsigned int
either is long int other is promoted > long int
either is unsigned int other is promoted > unsigned int
either is int other is promoted > int
Otherwise:
both operands are promoted to int
请注意。操作的最小大小是int。因此,在操作完成之前,short/char被提升为int。
在你的所有表达式中,int在操作执行之前被提升为float。操作的结果是float。
int + float => float + float = float
int * float => float * float = float
float * int => float * float = float
int / float => float / float = float
float / int => float / float = float
int / int = int
int ^ float => <compiler error>
我的解决方案到问题得到了WA(错误答案),然后我将int中的一个更改为long long int,它给出了交流(接受)。之前,我尝试执行long long int += int * int,在我将其纠正为long long int += long long int * int之后。我在谷歌上搜了一下,