codeforces15E Triangles
传送门:http://codeforces.com/problemset/problem/15/E
【题解】




# include <bits/stdc++.h>
using namespace std; typedef long long ll; const int mod = 1e9 + ; int main() {
int n;
cin >> n;
n >>= ; int t = , tem, res = , pwr = ;
for (int i=; i<=n; ++i) {
pwr <<= ;
if(pwr >= mod) pwr -= mod;
tem = pwr - ;
if(tem <= mod) tem += mod;
t = 1ll * t * tem % mod;
res = res + t;
if(res >= mod) res -= mod;
} res = 4ll * res % mod; int ans = 8ll * res % mod + ;
if(ans >= mod) ans -= mod;
ans = ans + 2ll * res * res % mod;
if(ans >= mod) ans -= mod; cout << ans; return ;
}
codeforces15E Triangles的更多相关文章
- Count the number of possible triangles
From: http://www.geeksforgeeks.org/find-number-of-triangles-possible/ Given an unsorted array of pos ...
- [ACM_搜索] Triangles(POJ1471,简单搜索,注意细节)
Description It is always very nice to have little brothers or sisters. You can tease them, lock them ...
- acdream.Triangles(数学推导)
Triangles Time Limit:1000MS Memory Limit:64000KB 64bit IO Format:%lld & %llu Submit Stat ...
- UVA 12651 Triangles
You will be given N points on a circle. You must write a program to determine how many distinctequil ...
- Codeforces Gym 100015F Fighting for Triangles 状压DP
Fighting for Triangles 题目连接: http://codeforces.com/gym/100015/attachments Description Andy and Ralph ...
- Codeforces Round #309 (Div. 1) C. Love Triangles dfs
C. Love Triangles Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/553/pro ...
- Codeforces Round #308 (Div. 2) D. Vanya and Triangles 水题
D. Vanya and Triangles Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/55 ...
- Project Euler 94:Almost equilateral triangles 几乎等边的三角形
Almost equilateral triangles It is easily proved that no equilateral triangle exists with integral l ...
- Project Euler 91:Right triangles with integer coordinates 格点直角三角形
Right triangles with integer coordinates The points P (x1, y1) and Q (x2, y2) are plotted at integer ...
随机推荐
- label上的事件操作执行两次
label上的事件执行两次 标签(空格分隔): 事件执行两次 今天在做公司项目的过程中,需要在表单元素单选框上绑定事件,执行相应的操作,结果发现事件执行了两次 具体代码: <div class= ...
- 处理编译错误"0" is an invalid value for the "DebugInformation" parameter of the "DCC" task.
在安装一个从XE6复制到XE4的控件时出现编译错误: [MSBuild Error] "0" is an invalid value for the "DebugInfo ...
- 使用 MQTTnet 快速实现 MQTT 通信
1 什么是 MQTT ? MQTT(Message Queuing Telemetry Transport,消息队列遥测传输)是 IBM 开发的一个即时通讯协议,有可能成为物联网的重要组成部分.MQT ...
- 使用Fiddler重定向App的网络请求
前言 开发中手机app只能访问生产环境地址,所以给开发调试带来不便,可以通过Fiddler的代理和urlreplace方式解决. 步骤 1.开启Fiddler的代理模式Tools->Teleri ...
- mybaits入门(含实例教程和源码) http://blog.csdn.net/u013142781/article/details/50388204
前言:mybatis是一个非常优秀的存储过程和高级映射的优秀持久层框架.大大简化了,数据库操作中的常用操作.下面将介绍mybatis的一些概念和在eclipse上的实际项目搭建使用. 一.mybati ...
- .net mvc C#生成网页快照
目标:调用某一网页,自动抓取整个页面为图片,并保存 public class WebSiteThumbnail { Bitmap m_Bitmap; string m_Url; public WebS ...
- 【刷题】洛谷 P4234 最小差值生成树
题目描述 给定一个标号为从 \(1\) 到 \(n\) 的.有 \(m\) 条边的无向图,求边权最大值与最小值的差值最小的生成树. 输入输出格式 输入格式: 第一行两个数 \(n, m\) ,表示图的 ...
- 【刷题】BZOJ 1926 [Sdoi2010]粟粟的书架
Description 幸福幼儿园 B29 班的粟粟是一个聪明机灵.乖巧可爱的小朋友,她的爱好是画画和读书,尤其喜欢 Thomas H. Cormen 的文章.粟粟家中有一个 R行C 列的巨型书架,书 ...
- 【BZOJ2655】Calc(拉格朗日插值,动态规划)
[BZOJ2655]Calc(多项式插值,动态规划) 题面 BZOJ 题解 考虑如何\(dp\) 设\(f[i][j]\)表示选择了\(i\)个数并且值域在\([1,j]\)的答案. \(f[i][j ...
- 洛谷 P2915 [USACO08NOV]奶牛混合起来Mixed Up Cows 解题报告
P2915 [USACO08NOV]奶牛混合起来Mixed Up Cows 题意: 给定一个长\(N\)的序列,求满足任意两个相邻元素之间的绝对值之差不超过\(K\)的这个序列的排列有多少个? 范围: ...