错误的地方:
invalid operands of types 'long long int' and 'double' to binary 'operator%'
百度翻译:“long long int”和“double”到binary“operator%”类型的操作数无效
即:long long 型的不能对double型取余
我认为的出错原因:(如果错误可以指出来~~~~)
因为1e9是10的9次幂(比如pow函数不是用来求幂的吗,它就是double类型的)
如果不定义它的话,默认就是double 类型,所以得把1e9定义成long long 才能用
#include<stdio.h>
int main()
{
long long x=87980809666666768;
long long mod=1e9;
printf("%lld",x%(mod+7));
//printf("%lld",x%(1e9+7));
}