CodeForces-450B Jzzhu and Sequences
来源:互联网 发布:如何修改4g网络设置 编辑:程序博客网 时间:2024/05/29 19:05
#include <iostream>#include <cstdio>using namespace std;const int maxn = 8;const int INF = 1e9 + 7;int num[maxn];int x, y, n;int main(){ while(~scanf("%d %d", & x, & y)) { num[1] = x % INF; num[2] = y % INF; num[3] = (y - x) % INF; num[4] = - num[1]; num[5] = - num[2]; num[6] = - num[3]; cin >> n; n %= 6; if(n == 0) { if(num[6] < 0) cout << INF + num[6] << endl; else cout << num[6] << endl; } else { if(num[n] < 0) cout << INF + num[n] << endl; else cout << num[n] << endl; } } return 0;}
题意:建一个序列。给出f1 = x, f2 = y 。fi = fi -1 + fi +1(都是下标)。之后再输入一个n。输出序列第n个数除以1000000007的余数。
题解:找规律水题。
0 0
- Codeforces 450 B. Jzzhu and Sequences
- Codeforces 450B Jzzhu and Sequences
- CodeForces 450-B. Jzzhu and Sequences
- CodeForces 450B Jzzhu and Sequences
- codeforces 450B Jzzhu and Sequences
- CodeForces-450B Jzzhu and Sequences
- codeforces 450B Jzzhu and Sequences
- CodeForces 450B Jzzhu and Sequences
- Codeforces 450B Jzzhu and Sequences
- CodeForces 450B-Jzzhu and Sequences
- Codeforces 450B Jzzhu and Sequences
- codeforces B. Jzzhu and Sequences
- Codeforces 450B Jzzhu and Sequences(矩阵快速幂)
- Codeforces 450B Jzzhu and Sequences(矩阵快速幂)
- Codeforces 450B Jzzhu and Sequences(递推找规律)
- Codeforces 450B-Jzzhu and Sequences (矩阵快速幂)
- codeforces 450-B Jzzhu and Sequences 矩阵快速幂
- Codeforces 450B Jzzhu and Sequences(矩阵快速幂)
- Android.mk解析
- 类的创建和初始化
- UITableViewCell cell中图片文字的自适应高度
- Git 練習與基本操作
- 多种tableview
- CodeForces-450B Jzzhu and Sequences
- C sharp中的“封装”
- I学霸官方免费教程二十五:Java基础教程之枚举 enum
- 【CodeVS4019】想越狱的黎恒健
- 线程与进程的区别
- WebView的应用
- 编程学习必备七个阶段
- Java中常见的异常错误
- 《struts2 in action》学习问题——零配置问题