#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. 关于oracle的基础增删改查操作总结

    ① 进入数据库: sqlplus“/as sysdba” 或者sqlplus / as sysdba 注:完整格式:  sqlplus“用户名/密码@数据库名as sysdba” 注:请注意,sqlp ...

  2. centos7 新增ip

    1.进入network-scripts目录:cd /etc/sysconfig/network-scripts/ 2.复制ifcfg-eth0: cp ifcfg-eth0 ifcfg-eth0:0 ...

  3. CodeForces 916A Jamie and Alarm Snooze (水题)

    题意:给定一个数字n,和一个时间,问你每次可以把当前时间往回调n分钟,然后调多少次后时间中包含数字7. 析:直接模拟就好,从当前分钟向后调,注意调成负数的情况就好.很简单. 代码如下: #pragma ...

  4. php7注意事项

    1. 不要使用 mysql_ 函数 这一天终于来了,从此你不仅仅“不应该”使用mysql_函数.PHP 7 已经把它们从核心中全部移除了,也就是说你需要迁移到好得多的mysqli_函数,或者更灵活的 ...

  5. (转载)Fiddler调式使用知多少(一)深入研究

    原文来源于:http://www.cnblogs.com/tugenhua0707/p/4623317.html,作者:涂根华 !个人觉得原作者写的特别好,故收藏于此 Fiddler调式使用(一)深入 ...

  6. Struts2之ModelDriven和Preparable拦截器

    首先struts.xml文件配置如下 默认拦截器设置为paramsPrepareParamsStack <package name="default" namespace=& ...

  7. 大压力下Redis参数调整要点

    调整以下参数,可以大幅度改善Redis集群的稳定性: 为何大压力下要这样调整? 最重要的原因之一Redis的主从复制,两者复制共享同一线程,虽然是异步复制的,但因为是单线程,所以也十分有限.如果主从间 ...

  8. JS库汇总[重要]

    库名称  说明 附加说明 URI 一款js 操作URL的插件 功能十分强大.可以增加 .修改.删除.参数   1.Animate.css 2.Hover.css 3.jQuery 4.WebUploa ...

  9. matlab矢量场数值可视化(动态数值模拟)

    https://blog.csdn.net/eric_e/article/details/81294092 D3.js实现数据可视化 三维可视化 风场可视化(数据插值):风场是动态变化的,实时刷新的, ...

  10. (CodeForces 548B 暴力) Mike and Fun

    http://codeforces.com/problemset/problem/548/B Mike and some bears are playing a game just for fun. ...