#include<iostream>
#define MAXN 1005
#include<stdio.h>
using namespace std; int _m[MAXN]; int main()
{
//freopen("acm.acm","r",stdin);
int num;
int a, b, c, d, e, f, g, h, i;
int j;
cin>>num;
while(num --)
{
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i;
_m[] = a;
_m[] = b;
_m[] = c;
for(j = ; j <= i; ++ j)
{
if(j% != )
{
_m[j] = (g + (d*_m[j-] + e*_m[j-] - f*_m[j-])%g)%g;
}
if(j% == )
{
_m[j] = (h + (f*_m[j-] - d*_m[j-] + e*_m[j-])%h)%h;
}
}
cout<<_m[i]<<endl;
}
}

POJ 2696的更多相关文章

  1. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  2. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  3. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  4. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  5. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

  6. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

  7. POJ 2255. Tree Recovery

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11939   Accepted: 7493 De ...

  8. POJ 2752 Seek the Name, Seek the Fame [kmp]

    Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 17898   Ac ...

  9. poj 2352 Stars 数星星 详解

    题目: poj 2352 Stars 数星星 题意:已知n个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...

随机推荐

  1. Spring+mvc错误

    1.2016-11-13 16:49:22 原因:@ResponseBody注解没加

  2. C#装箱,拆箱和强制转换(转)

    出处:https://www.cnblogs.com/fengjiulin110120/p/6605739.html 关系: 强制转换就包含有装箱拆箱操作,装箱就是把值类型转换成引用类型,反之就是拆箱 ...

  3. Silverlight4.0正式版(Silverlight4_Tools)离线安装

    1.从微软的网站下载Silverlight4_Tools.exe(或者http://download.csdn.net/detail/taomanman/4522848)2.执行Silverlight ...

  4. DOS下如何打开程序

    cd c:    #先切回主盘,因为最开始在C:\Users\Administrator这个目录下 cd “指定文件所在的盘:”      #切换到文件所在盘 print "文件目录&quo ...

  5. Swift3翻天覆地的改变

    经历了从swift 1.0 到2.0,一个版本之后代码居然就不兼容了.这如何在团队推广呢?没有想到3.0居然变化更加的大.有多大,来体会一下: UIFont.preferredFontForTextS ...

  6. TypeError: c is null

    找到相应的js报错地方..添加判断条件 if(styles == null) {     return ''; }

  7. 20145232 韩文浩 《Java程序设计》第6周学习总结

    教材学习内容总结 Java是以串流(Stream)的方式来处理输入与输出. 串流是一种抽象观念,从键盘输入资料,将处理结果输入档案,以及读取档案的内容等动作皆视为串流的处理. 输入串流代表对象为jav ...

  8. spring-事务管理学习

    Ok,spring的源码学习到了事务这块就大概要告一段落了,后续如果有机会的话,会开启spring-boot的学习.不过目前还是打算把下一段的学习计划放在其他事情上.先对事务这块做一个简要的学习笔记, ...

  9. poj 1129 搜索

    Channel Allocation Time Limit: 1000 MS Memory Limit: 10000 KB 64-bit integer IO format: %I64d , %I64 ...

  10. Ubuntu 修改环境变量

    按变量的生存周期来划分,Linux变量可分为两类,它们的修改方法如下:(1)永久的:需要修改配置文件,变量永久生效. 常见的配置文件包括: (1-1)/etc/profile:对所有用户生效:此文件为 ...