Codeforces Jzzhu and Sequences(圆形截面)
# include <stdio.h>
int f[10];
int main()
{
int x,y,n,j;
while(~scanf("%d%d%d",&x,&y,&n))
{ f[1]=x;
f[2]=y;
for(j=3;j<=6;j++)
{
f[j]=f[j-1]-f[j-2];
}
n%=6;
if(n==0)
n=6;
if(f[n]>=0)
printf("%d\n",f[n]%1000000007);
else
while(f[n]<0)//注意负数取模 然后就没有然后了~~~~~
f[n]+=1000000007;
printf("%d\n",f[n]%1000000007);
}
return 0;
}
版权声明:本文博客原创文章,博客,未经同意,不得转载。
Codeforces Jzzhu and Sequences(圆形截面)的更多相关文章
- CodeForces 450B Jzzhu and Sequences (矩阵优化)
CodeForces 450B Jzzhu and Sequences (矩阵优化) Description Jzzhu has invented a kind of sequences, they ...
- Codeforces Round #257(Div. 2) B. Jzzhu and Sequences(矩阵高速幂)
题目链接:http://codeforces.com/problemset/problem/450/B B. Jzzhu and Sequences time limit per test 1 sec ...
- Codeforces Round #257 (Div. 2 ) B. Jzzhu and Sequences
B. Jzzhu and Sequences time limit per test 1 second memory limit per test 256 megabytes input standa ...
- CodeForces - 450B Jzzhu and Sequences —— 斐波那契数、矩阵快速幂
题目链接:https://vjudge.net/problem/CodeForces-450B B. Jzzhu and Sequences time limit per test 1 second ...
- codeforces 450B B. Jzzhu and Sequences(矩阵快速幂)
题目链接: B. Jzzhu and Sequences time limit per test 1 second memory limit per test 256 megabytes input ...
- Codeforces450 B. Jzzhu and Sequences
B. Jzzhu and Sequences time limit per test 1 second memory limit per test 256 megabytes input standa ...
- CF450B Jzzhu and Sequences(矩阵加速)
CF450B Jzzhu and Sequences 大佬留言:这.这.不就是矩乘的模板吗,切掉它!! You are given xx and yy , please calculate $f_{n ...
- 数学 找规律 Jzzhu and Sequences
A - Jzzhu and Sequences Jzzhu has invented a kind of sequences, they meet the following property: ...
- Codeforces Round #257 (Div. 2) B Jzzhu and Sequences
Jzzhu has invented a kind of sequences, they meet the following property: You are given x and y, ple ...
随机推荐
- DLP显示单元(威创)
品牌:威创型号:E-SX675生产商:广东威创视讯科技股份有限公司1.生厂商简介(1)生产商概述广东威创视讯科技股份有限公司(简称威创)成立于2002年,专业从事大屏幕拼接显示产品及其解决方案的研发. ...
- 浅析——SCTP协议(转)
SCTP处于SCTP用户应用层与IP网络层之间,它运用“关联”(association)这个术语定义交换信息的两个对等SCTP用户间的协议状态 .SCTP也是面向连接的,但在概念上,SCTP“关联”比 ...
- PreferenceActivity使用示例
MainActivity如下: package cn.testpreferenceactivity; import android.content.SharedPreferences; import ...
- hdu 4706 Children's Day 2013年ICPC热身赛A题 模拟
题意:按字母顺序排列成n型,简单的模拟题. 当字母排到z时从a开始重新排起. 代码: /* * Author: illuz <iilluzen[at]gmail.com> * Blog: ...
- Python天天美味(25) - 深入理解yield
Python天天美味(25) - 深入理解yield - CoderZh - 博客园 Python天天美味(25) - 深入理解yield yield的英文单词意思是生产,刚接触Python的时候 ...
- javascript 下拉列表 自己主动取值 无需value
<select id="applyType" name="$!{status.expression}" class="inp" onc ...
- 动态创建按钮的JS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEA ...
- codeforces584B Kolya and Tanya
题目链接:http://codeforces.com/problemset/problem/584/B 解题思路:当n=1时,_______ _______ ______ 三个数每位上可以 ...
- PyMOTW: heapq¶
PyMOTW: heapq — PyMOTW Document v1.6 documentation PyMOTW: heapq¶ 模块: heapq 目的: 就地堆排序算法 python版本:New ...
- hdu Crazy Circuits
Crazy Circuits 题目: 给出一个电路板,从+极出发到负极. 如今给你电路板上的最小电流限制,要你在电流平衡的时候求得从正极出发的最小电流. 算法: 非常裸的有源汇最小流.安有源汇最大流做 ...