# 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(圆形截面)的更多相关文章

  1. CodeForces 450B Jzzhu and Sequences (矩阵优化)

    CodeForces 450B Jzzhu and Sequences (矩阵优化) Description Jzzhu has invented a kind of sequences, they ...

  2. 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 ...

  3. 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 ...

  4. CodeForces - 450B Jzzhu and Sequences —— 斐波那契数、矩阵快速幂

    题目链接:https://vjudge.net/problem/CodeForces-450B B. Jzzhu and Sequences time limit per test 1 second ...

  5. codeforces 450B B. Jzzhu and Sequences(矩阵快速幂)

    题目链接: B. Jzzhu and Sequences time limit per test 1 second memory limit per test 256 megabytes input ...

  6. Codeforces450 B. Jzzhu and Sequences

    B. Jzzhu and Sequences time limit per test 1 second memory limit per test 256 megabytes input standa ...

  7. CF450B Jzzhu and Sequences(矩阵加速)

    CF450B Jzzhu and Sequences 大佬留言:这.这.不就是矩乘的模板吗,切掉它!! You are given xx and yy , please calculate $f_{n ...

  8. 数学 找规律 Jzzhu and Sequences

    A - Jzzhu and Sequences   Jzzhu has invented a kind of sequences, they meet the following property: ...

  9. 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 ...

随机推荐

  1. jyphon 环境变量配置

    Jyphon 是基于java平台python 的一种实现 官网: http://www.jython.org/ 可以从官网下载 jyphon 安装 下载 jython Installer ,下载之后是 ...

  2. window2003远程桌面“已达最大连接数”

    使用命令行强制注销远程登录用户 Fri, 04/19/2013 - 09:29 - admin 来源地址: http://space.itpub.net/10067101/viewspace-6147 ...

  3. jstorm简介(转)

    Jstorm是参考storm的实时流式计算框架,在网络IO.线程模型.资源调度.可用性及稳定性上做了持续改进,已被越来越多企业使用 作为commiter和user,我还是非常看好它的应用前景,下面是在 ...

  4. 使用commons-daemon启动、关闭java程序

    系统环境: CentOS 7 X64 JDK1.8 一: 安装jsvc 下载 commons-daemon的源代码包 http://apache.fayea.com//commons/daemon/s ...

  5. 【Demo 0016】SQLite 数据库

    本章学习要点:       1.  熟悉SQL语句:       2.  掌握SQLit库的基本用法;        3.  掌握SQLite封装:

  6. 指尖上的电商---(12)SolrAdmin中加入多核的还有一种方法

    这一节中我们演示下solr中创建多核的还有一种方法. 接第10讲,首先关闭tomcatserver 1.解压solr-4.8.0后,找到solr-4.8.0以下的example目录下的multicor ...

  7. codeforces 598B Queries on a String

    题目链接:http://codeforces.com/problemset/problem/598/B 题目分类:字符串 题意:给定一个串,然后n次旋转,每次给l,r,k,表示区间l到r的字符进行k次 ...

  8. pomelo源代码分析(一)

    千里之行始于足下,一直说想了解pomelo,对pomelo有兴趣,但一直迟迟没有去碰,尽管对pomelo进行源代码分析,在网络上肯定不止我一个,已经有非常优秀的前辈走在前面,如http://golan ...

  9. 欧舒丹 L'Occitane 活力清泉保湿面霜 - 男士护肤 - 香港草莓网StrawberryNET.com

    欧舒丹 L'Occitane 活力清泉保湿面霜 - 男士护肤 - 香港草莓网StrawberryNET.com 欧舒丹 活力清泉保湿面霜 50ml/1.7oz

  10. String、StringBuffer与StringBuilder差分

    的位置不言而喻.那么他们究竟有什么优缺点,究竟什么时候该用谁呢?以下我们从以下几点说明一下 1.三者在运行速度方面的比較:StringBuilder >  StringBuffer  >  ...