# 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. 使用JDBC获取能自动增加的主键

    本篇讲述如何使用JDBC获取能自动增加的主键的值.有时候我们在向数据库插入数据时希望能返回主键的值,而不是通过查询的方式.一般来说,在多表相互关联主键约束,也就是说别的表的外键约束是该表的主键,那么在 ...

  2. Ace of Aces

    Description There is a mysterious organization called Time-Space Administrative Bureau (TSAB) in the ...

  3. SuperSocket应用之FTP源码解析

    一 简述 命令行协议是一种使用比较多的协议,其优点在于使用简单易于扩展性,同时也利于解析和使用.FTP,POP,SMTP等均采用命令行协议,其中FTP在早起互联网时期成为网络资源共享的主要方式,可见F ...

  4. 基于visual Studio2013解决面试题之0202上下排

     题目

  5. [置顶] Ftp客户端概要设计

    Ftp客户端概要设计 1.概述 ftp是基于TCP的文件传输协议,主要是用于控制远程文件,如下载.上传.续传.重命名.删除等.其命令是基于可见字符,易于理解的方式交互的.客户端与服务器端的交互遵循一应 ...

  6. 再说Java EE

    说到JavaEE(曾经叫J2EE)是什么,你可能回答:JavaEE是一组规范,这么说是没错,可是自己不认为这个答案非常大.非常空么?什么又是规范?规范能组成应用么?能在JVM中跑起来么?要理解这些,先 ...

  7. Mac OS升级到Yosemite后一些问题

    苹果"优山美地"採用移动设备平面风格,看起来还是相当清爽. 只是升级完还是有一些程序兼容性问题的. 1. 开发Android的程序猿们,Java se 6 须要升级到2014_00 ...

  8. jQuery 自学笔记—8 常见操作

    jQuery 拥有可操作 HTML 元素和属性的强大方法. jQuery DOM 操作 jQuery 中非常重要的部分,就是操作 DOM 的能力. jQuery 提供一系列与 DOM 相关的方法,这使 ...

  9. git版本号回滚

    先说今天遇到的问题,看到一个config.php的配置文件一直在改动的状态下,可是和远程的config.php是不一致的,我不须要提交它,可是看它在 modified的状态下,非常不爽.想删除它.gi ...

  10. POJ 3189 Steady Cow Assignment【网络流】

    题意:每个奶牛对所有的牛棚有个排名(根据喜欢程度排的),每个牛棚能够入住的牛的数量有个上限,重新给牛分配牛棚,使牛棚在牛心中的排名差(所有牛中最大排名和最小排名之差)最小. 牛棚个数最多为20,那么直 ...