编程之美之格格取数
来源:互联网 发布:深圳淘宝加盟公司 编辑:程序博客网 时间:2024/06/10 22:39
#include<iostream>//����������С���� ֮ С����
#include<cmath>
using namespace std;
int lfh(int n)
{
return (n*(n+1)/2)*(n*(n+1)/2);
}
unsigned int js(int n)
{
unsigned int ms=0;
unsigned int sum=0;
unsigned int num=0;
unsigned int zsum=0;
unsigned int temp1,temp2,temp3;
ms=pow(10,9)+7;
for(int i=1;i<=n-2;i++)
{
temp1=n+1-i;
for(int j=i+1;j<=n-1;j++)
{
temp2=n+1-j;
for(int k=j+1;k<=n;k++)
{
temp3=n+1-k;
num=temp1*temp2*temp3;
sum=num+sum%ms;
}
}
}
zsum=((sum*2%ms)*3%ms+lfh(n))%ms;
return zsum;
}
int main()
{
int a[10]={0};
int T;
cin>>T;
for(int i=0;i<T;i++)
cin>>a[i];
for(int j=0;j<T;j++)
cout<<"Case "<<j+1<<": "<<js(a[j])<<endl;;
return 0;
}
0 0
- 编程之美之格格取数
- 编程之美2014格格取数
- 编程之美 格格取数问题
- 编程之美2014格格取数
- 编程之美2014格格取数
- 编程之美-格格取数
- 编程之美2014格格取数(回溯法)
- 2014编程之美资格赛 题目3 : 格格取数
- 编程之美2014资格赛题目3:格格取数
- 编程之美 打酱油 格格取数
- 2014编程之美资格赛第三题-格格取数
- 【编程之美资格赛】题目3 : 格格取数
- 编程之美 格格取数 C语言版本
- 编程之美格格取数(为什么一直是WA,求测试)
- [2014]编程之美第3题,格格取数问题
- 2014 编程之美 资格赛 第三题 格格取数(二分图带权最小边覆盖)
- 编程之美 2014 格格取数(最小费用最大流)
- 2014 编程之美 预赛第三题 格格取数 上下界费用流
- Asakura的魔法世界
- 浮躁
- 小Y的难题
- 群聊天
- 自定义ViewGroup
- 编程之美之格格取数
- 如何高效使用Google
- 放积木
- 计算机网络(1)
- Mybatis入門實例
- 地铁站问题
- Android中Http请求中问乱码问题解决
- 四则运算之后缀求值
- Linux设备驱动之Framebuffer分析