http://acm.zzuli.edu.cn/problem.php?cid=1286&pid=6
一道简单的大数取模问题
AC代码:
#include<cstdio>
#include<iostream>
using namespace std;
const int maxn=1e9+7;
int main()
{
int T;
cin>>T;
while(T--)
{
int m,n;
cin>>m>>n;
long long int sum=0;
for(int i=1;i<=m;i++)
{
sum+=n;
}
cout<<(sum+maxn)%maxn<<endl;//最后结果要这样写,避免出现数据超限问题
}
return 0;
}
最后
以上就是苗条白羊最近收集整理的关于简单的取模问题的全部内容,更多相关简单内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复