A11508 | Sum the Fibonacci
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
You are given an array $s$ of $n$ non-negative integers.
A 5-tuple of integers $(a,b,c,d,e)$ is said to be valid if it satisfies the following conditions:
- $1<=a,b,c,d,e<=n$
- $(s_{a}$ | $s_{b})$ & $s_{c}$ & $(s_{d}$ ^ $s_{e})=2^{i}$ for some integer $i$
- $s_{a}$ & $s_{b}=0$
Here, '|' is the bitwise OR, '&' is the bitwise AND and '^' is the bitwise XOR operation.
Find the sum of $f(s_{a}$ | $s_{b})*f(s_{c})*f(s_{d}$ ^ $s_{e})$ over all valid 5-tuples $(a,b,c,d,e)$ , where $f(i)$ is the $i$ -th Fibonnaci number ( $f(0)=0,f(1)=1,f(i)=f(i-1)+f(i-2)$ ).
Since answer can be is huge output it modulo $10^{9}+7$ .
A 5-tuple of integers $(a,b,c,d,e)$ is said to be valid if it satisfies the following conditions:
- $1<=a,b,c,d,e<=n$
- $(s_{a}$ | $s_{b})$ & $s_{c}$ & $(s_{d}$ ^ $s_{e})=2^{i}$ for some integer $i$
- $s_{a}$ & $s_{b}=0$
Here, '|' is the bitwise OR, '&' is the bitwise AND and '^' is the bitwise XOR operation.
Find the sum of $f(s_{a}$ | $s_{b})*f(s_{c})*f(s_{d}$ ^ $s_{e})$ over all valid 5-tuples $(a,b,c,d,e)$ , where $f(i)$ is the $i$ -th Fibonnaci number ( $f(0)=0,f(1)=1,f(i)=f(i-1)+f(i-2)$ ).
Since answer can be is huge output it modulo $10^{9}+7$ .
输入格式
The first line of input contains an integer $n$ ( $1<=n<=10^{6}$ ).
The second line of input contains $n$ integers $s_{i}$ ( $0<=s_{i}<2^{17}$ ).
The second line of input contains $n$ integers $s_{i}$ ( $0<=s_{i}<2^{17}$ ).
输出格式
Output the sum as described above, modulo $10^{9}+7$
输入输出样例
输入 #1
2 1 2
输出 #1
32
输入 #2
3 7 4 1
输出 #2
3520
输入 #3
10 1 3 0 7 3 7 6 5 7 5
输出 #3
1235424
输入 #4
10 50 9 11 44 39 40 5 39 23 7
输出 #4
113860062
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted