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 ...
随机推荐
- 评论alpha发布以及PSP
讲解顺序: 1. 俄罗斯方块 武志远 俄罗斯方块有自己新颖的玩法加在里面 ,可以进行游戏,界面友好但不美观,与传统玩法相比增加了经验值,这是一个很好的创意,游戏运行也很流畅,并找到两名同学现场体 ...
- Mscomm控件安装问题 License information for TMSComm not found.
操作步骤: 1.打开delphi,菜单选择compoents->import Activex control,然后选择那个mscomm32.ocx安装即可. 2.注册MScomm控件 开始- ...
- XLSReadWriteII5使用示例
之前一直是使用XLSReadWriteII4,今天更新到XLSReadWriteII5,测试了一下,发现一些操作变化比较大,现将XLSReadWriteII5的使用示例写一下,以下是代码和生成的exc ...
- sqlserver实现树形结构递归查询(无限极分类)
SQL Server 2005开始,我们可以直接通过CTE来支持递归查询,CTE即公用表表达式 百度百科 公用表表达式(CTE),是一个在查询中定义的临时命名结果集将在from子句中使用它.每个CTE ...
- Js 中的原始值和引用值
最近遇写 node.js 时到一个问题,把对象当赋值给数组成员时总是出错,比如下面的代码, var Arr = new Array(); var Obj = new Object(); for(var ...
- 【vue】router-link 与 router-view
1 router-link <router-link :to="{ path: '/hello', component: HelloWorld }">hello< ...
- notepad++ 安装go插件
1. 想学习go语言 使用notepad++ 但是发现无法安装 gonpp的插件 花了很长时间. 发现问题为: 前几天将notepad++ 升级到了 7.6 的版本 然后使用 plugin manag ...
- delphi手动创建dataset并插入值
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, Syste ...
- POJ3281_Dining
有一些饮料和食物,每种一个,每个客人喜欢一些饮料和一些食物,每个客人可以选择一种饮料和一种食物,问最多能够同时满足多少个客人同时拥有饮料和食物. 这样的,源点连接饮料,汇点连接食物,中间人分别连接饮料 ...
- BZOJ 2243 染色 | 树链剖分模板题进阶版
BZOJ 2243 染色 | 树链剖分模板题进阶版 这道题呢~就是个带区间修改的树链剖分~ 如何区间修改?跟树链剖分的区间询问一个道理,再加上线段树的区间修改就好了. 这道题要注意的是,无论是线段树上 ...