题目传送门

 /*
题意:每支队伍需求打印机打印n张纸,当打印纸数累计到s时,打印机崩溃,打印出当前打印的纸数,s更新为(s*x+y)%mod
累计数清空为0,重新累计
模拟简单题:关键看懂题意
注意:打印机一张一张纸打印,当某支队伍打印完正好累计到s时,要输出0,坑点!
*/
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std; int cnt[];
char ss[][]; int main(void) //J Contest Print Server
{
//freopen ("J.txt", "r", stdin); int t;
while (scanf ("%d", &t) == )
{
while (t--)
{
int n, s, x, y, mod;
scanf ("%d%d%d%d%d", &n, &s, &x, &y, &mod); for (int i=; i<=n; ++i)
scanf ("%s request %d pages", &ss[i], &cnt[i]); int num = , j;
int ok = ;
for (int i=; i<=n; ++i)
{
if (ok == ) printf ("%d pages for %s\n", , ss[i]);
ok = ;
for (j=; j<=cnt[i]; ++j)
{
num++;
if (num == s)
{
printf ("%d pages for %s\n", j, ss[i]);
s = (s * x + y) % mod;
if (s == ) s = (s * x + y) % mod;
num = ; break;
}
}
if (j < cnt[i]) i--;
else if (j == cnt[i]) ok = ;
else printf ("%d pages for %s\n", cnt[i], ss[i]);
}
if (t) puts ("");
} } return ;
} /*
1 pages for Team1
5 pages for Team2
1 pages for Team3 1 pages for Team1
3 pages for Team2
5 pages for Team2
1 pages for Team3
*/

模拟 2013年山东省赛 J Contest Print Server的更多相关文章

  1. 山东省赛J题:Contest Print Server

    Description In ACM/ICPC on-site contests ,3 students share 1 computer,so you can print your source c ...

  2. 2013年山东省第四届ACM大学生程序设计竞赛J题:Contest Print Server

    题目描述     In ACM/ICPC on-site contests ,3 students share 1 computer,so you can print your source code ...

  3. 2013年山东省第四届ACM大学生程序设计竞赛-最后一道大水题:Contest Print Server

    点击打开链接 2226: Contest Print Server Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 53  Solved: 18 [Su ...

  4. 2013年山东省赛F题 Mountain Subsequences

    2013年山东省赛F题 Mountain Subsequences先说n^2做法,从第1个,(假设当前是第i个)到第i-1个位置上哪些比第i位的小,那也就意味着a[i]可以接在它后面,f1[i]表示从 ...

  5. sdutoj 2624 Contest Print Server

    http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2624 Contest Print Server ...

  6. [原]sdut2624 Contest Print Server (大水+大坑)山东省第四届ACM省赛

    本文出自:http://blog.csdn.net/svitter 原题:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&am ...

  7. 2013成都网络赛 J A Bit Fun(水题)

    A Bit Fun Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  8. HDU 4800/zoj 3735 Josephina and RPG 2013 长沙现场赛J题

    第一年参加现场赛,比赛的时候就A了这一道,基本全场都A的签到题竟然A不出来,结果题目重现的时候1A,好受打击 ORZ..... 题目链接:http://acm.hdu.edu.cn/showprobl ...

  9. 位运算 2013年山东省赛 F Alice and Bob

    题目传送门 /* 题意: 求(a0*x^(2^0)+1) * (a1 * x^(2^1)+1)*.......*(an-1 * x^(2^(n-1))+1) 式子中,x的p次方的系数 二进制位运算:p ...

随机推荐

  1. 淘宝(阿里百川)手机客户端开发日记第二篇 android首页之顶部轮播特效制作 (二)

    1.我们来设计flash_slide.xml 布局,这个xml主要做成模块化,方便其它的activity可以动态去调用. flash_slide.xml内容如下: <?xml version=& ...

  2. unity3d 参考坐标系

    原地址:http://www.cnblogs.com/88999660/archive/2013/04/01/2993844.html 参考坐标系(Reference Coordinate Syste ...

  3. How to Configure Nginx for Optimized Performance

    Features Pricing Add-ons Resources | Log in Sign up   Guides & Tutorials Web Server Guides Nginx ...

  4. linux里的vi怎么移动到最后一行

    下面是几个vi与行移动有关的命令: G:光标移至最后一行 nG:光标移至第n行首 n+:光标下移n行 n-:光标上移n行 注意输入命令,需要首先按ESC键回到命令模式. 转自: http://zhid ...

  5. 基础知识《零》---Java程序运行机制及运行过程

    Java运行机制 Java虚拟机(Java Virtual Machine):Java虚拟机可以理解成一个以字节码为机器指令的CPU:对于不同的运行平台,有不同的虚拟机:Java虚拟机机制屏蔽了底层运 ...

  6. Search a 2D Matrix | & II

    Search a 2D Matrix II Write an efficient algorithm that searches for a value in an m x n matrix, ret ...

  7. 开博一周总结与随谈[thinking of writing blog for one week]

    8天前,就是5月19号,突发奇想,觉得应该开个博客记录下自己的学习笔记和心得,更重要的是做个自我梳理和总结.大致看了下国内的博客,最后选定cnblogs.之所以选则cnblogs是因为平时搜到不少好文 ...

  8. 如何在命令行下运行kettle的作业(job)和转换(transform)

    pan 是执行转换的. Pan.bat /file C:\test.ktr /logfile c:\log.txt /level Basic kitchen是执行job的. kitchen.bat / ...

  9. 【USACO】clocks 遇到各种问题 最后还是参考别人的思路

    //放在USACO上一直通不过 不知道哪里出了问题 输出的n总是等于1 但是BFS递归的次数是对的 <----这个问题解决了 局部变量压入queue中返回就是对的了 #include<io ...

  10. 山峰(codevs 1531)

    1531 山峰  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond 题解       题目描述 Description Rocky山脉有n个山峰,一字排开,从 ...