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 ...
随机推荐
- json 数组
/** * 获取 选中的id * @returns {*} */function getCheckedList(){ var groups =[]; $("input[name='check ...
- input、textArea实时显示剩余可输入的字数
<h2>实时显示剩余可输入的字数(字母,数字,中文都算一个字)</h2> <h>昵称:</h> <div> <input type=& ...
- node websocket学习研究
websocket作为不同于http的数据传输方式,是开发一些实时系统的不二选择. 最近在研究开发websocket方面的小程序.小程序客户端直接对websocket做了封装.自己只要写后端就可以了. ...
- [转帖]MBR与UEFI
从Intel 6系列主板之后,就开始提供UEFI BIOS支持,正式支持GPT硬盘分区表,一举取代了此前的MBR分区表格式,不过为了保持对老平台的兼容,微软即使最新的Windows 10系统也继续提供 ...
- delphi如何检索adoquery里面某一列存在的重复行?
var IsHave:Boolean; begin adoquery.first; while(not adoquery.eof) do begin if(adoquery.fieldbyname(' ...
- 拦截器的顺序是按照xml中的顺序执行的
- Windows下python 3.0版本django的安装、配置、与启动
使用的环境是Windows操作系统,python的环境是3.6,django是官网上最新的版本1.10.6,本文介绍从安装python之后怎样用过pip管理工具安装django,以及django的项目 ...
- 【刷题】BZOJ 1934 [Shoi2007]Vote 善意的投票
Description 幼儿园里有n个小朋友打算通过投票来决定睡不睡午觉.对他们来说,这个问题并不是很重要,于是他们决定发扬谦让精神.虽然每个人都有自己的主见,但是为了照顾一下自己朋友的想法,他们也可 ...
- loj6070【山东集训第一轮Day4】基因
题解: 分块对每个块的起点$st[i]$到$n$做一次回文自动机; 由于子串的回文自动机是原串的子图,所以并不需要重新构图,在原来的图上做即可: 做的时候记录某个终点的本质不同的回文串和$sum[i] ...
- Gogs安装配置(快速搭建版)转载
gogs官网 oschina gogs介绍 一句话描述: 一款极易搭建的自助 Git 服务. 环境 centos7:golang+mysqldb+git 安装配置环境 yum install mysq ...