codeforces 450B Jzzhu and Sequences
来源:互联网 发布:网络数字用语例如2333 编辑:程序博客网 时间:2024/05/29 18:27
题目链接:http://codeforces.com/contest/450/problem/B
解题思路:找循环节,注意当f[i]是负数的时候一定要把他加上mod直到>0为止;
e:- 3 % 4 == 1;
#include <iostream>using namespace std;const int mod=1e9+7;typedef long long LL;LL f[10];int main(){ LL x,y,k; while(cin>>x>>y>>k) { x = (x + mod) % mod; y = (y + mod) % mod; f[0] = x; f[1] = y; f[2] = (y - x + mod) % mod; f[3] = (-x + mod) % mod; f[4] = (-y + mod) % mod; f[5] = (x - y +mod) % mod; cout<<f[(k-1) % 6]<<endl; } return 0;}
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(矩阵快速幂)
- GRE写作必备句型
- linux中的通配符、元字符、转义符
- Enea公司----OSE/OSEck RTOS --2
- PAT 1012. The Best Rank (25)
- IOS中使用CGContext画图填充渐变颜色图层
- codeforces 450B Jzzhu and Sequences
- 5立项管理
- Android学习笔记(4)--反编译
- SQLServer过滤文件名特殊字符(利用SQLServer修改文件物理地址名称)
- 【学习笔记】-HTTP通信
- HTTP协议详解
- Dynamic Time Warping 动态时间规整算法
- XSHELL ssh vim 语法高亮配置
- ViewPager+动态加载网络图片