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 ...
随机推荐
- [BUAA_SE_2017]提问回顾
提问回顾 学期初疑问回答 学期初疑问博客 教材中说,PM在衡量需求时需要方方面面的能力与研究.可是,当下许多互联网IT公司只承担外包业务,即客户给什么需求就实现什么需求,甚至可能不要求其它先进的功能. ...
- Hive如何加载和导入HBase的数据
当我们用HBase 存储实时数据的时候, 如果要做一些数据分析方面的操作, 就比较困难了, 要写MapReduce Job. Hive 主要是用来做数据分析的数据仓库,支持标准SQL 查询, 做数据分 ...
- sql update set from 的用法 (转)
关键字: update set from 下面是这样一个例子: 两个表a.b,想使b中的memo字段值等于a表中对应id的name值 表a:id, name 1 ...
- sguf冲销脚本的实现
1.该脚本为PCISS项目的sguf冲销脚本: DECLARE type typ_sguf_table is table of sguf_rowid_tab_1%rowtype ; sguf_tab ...
- 2012r2 以及 2012r2 withupdate 已经安装更新的差异
0. 2012r2 不管带不带 update 1 他的版本号 都是 6.3.9600 如图示 2012r2的发布时间是 2013年 2012r2withupdate的发布时间是 2014年. 查看补丁 ...
- CSS 报错
- how install svn client on MacOS
how install svn client on MacOS svn https://www.smartsvn.com/downloads/smartsvn/smartsvn-macosx-11_0 ...
- Java并发编程实战2-线程安全
1. 定义 一个类是线程安全的,是指在被多个线程访问时,类可以持续进行正确的行为. 2. WHY 我们想要的是线程安全的程序,为什么在线程安全的开始讲线程安全的类呢? 编写线程安全的代码,本质上就是管 ...
- 关于#pragma comment
#pragma comment(lib,"ws2_32.lib") #pragma comment(lib,"ws2_32.lib")表示连接Ws2_32.li ...
- CF915E Physical Education Lessons
题意: Alex高中毕业了,他现在是大学新生.虽然他学习编程,但他还是要上体育课,这对他来说完全是一个意外.快要期末了,但是不幸的Alex的体育学分还是零蛋! Alex可不希望被开除,他想知道到期末还 ...