#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. java中的四种修饰符:private、protected、public和default的区别

      本类 本包 子类 包外 public 可以 可以 可以 可以 protected 可以 可以 可以 不可以 default 可以 可以 不可以 不可以 private 可以 不可以 不可以 不可以 ...

  2. denyhost部署

    部署 tar xzf DenyHosts-2.6.tar.gz -C /uc cd /uc/DenyHosts-2.6 python setup.py install running install ...

  3. MySQL 安装与使用(三)

    操作系统:CentOS release 5.10 (Final) MySQL版本:5.1.72-community 占位学习与编辑中……

  4. C++之const限定符(顶层const,底层const)

    作者:tongqingliu 转载请注明出处:http://www.cnblogs.com/liutongqing/p/7050815.html C++之const限定符(顶层const,底层cons ...

  5. Simultaneous Localization and Mapping Technology Based on Project Tango

    Abstract: Aiming at the problem of system error and noise in simultaneous localization and mapping ( ...

  6. python使用数据库的一些操作

    学py感觉还是用linux操作系统比较好,下载安装mysql很简单,linux里面都有自带的,但是要用python去用mysql我们就得安装一下他的模块,因为python里面没有自带他的模块,用yum ...

  7. 你可能不知道的Shell

    Shell也叫做命令行界面,它是*nix操作系统下用户和计算机的交互界面.Shell这个词是指操作系统中提供访问内核服务的程序. 这篇文章向大家介绍Shell一些非广为人知.但却实用有趣的知识,权当品 ...

  8. spring-事务管理学习

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

  9. 3D打印软件工具

    切片与工艺规划(打印)软件: 3D打印中另外两个重要的步骤(切片和打印)中可以用到的一些开源,免费的软件和应用 Cura        开源, 免费                    Python ...

  10. win10专业版激活工具很不错!

    下载链接:   http://www.yishimei.cn/?=0xj20