第四届省赛试题 模拟 Contest Print Server
来源:互联网 发布:飞艇气囊体积计算数据 编辑:程序博客网 时间:2024/06/06 14:27
Contest Print Server
Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^
题目描述
输入
In each case,the first line contains 5 integers n,s,x,y,mod (1<=n<=100, 1<=s,x,y,mod<=10007), and n lines of requests follow. The request is like "Team_Name request p pages" (p is integer, 0<p<=10007, the length of "Team_Name" is no longer than 20), means the team "Team_Name" need p pages to print, but for some un-know reason the printer will break down when the printed pages counter reached s(s is generated by the function s=(s*x+y)%mod ) and then the counter will become 0. In the same time the last request will be reprint from the very begin if it isn't complete yet(The data guaranteed that every request will be completed in some time).
You can get more from the sample.
输出
Please note that you should print an empty line after each case.
示例输入
23 7 5 6 177Team1 request 1 pagesTeam2 request 5 pagesTeam3 request 1 pages3 4 5 6 177Team1 request 1 pagesTeam2 request 5 pagesTeam3 request 1 pages
示例输出
1 pages for Team15 pages for Team21 pages for Team31 pages for Team13 pages for Team25 pages for Team21 pages for Team3
提示
来源
示例程序
#include<iostream>#include<cstdio>#include<cstring>#include<math.h>using namespace std;int n,s,x,y,mod;char ss[300];int i,j,t;int T;int h3,h4;struct node{ int x,f; char name[30];} unit[300];int judge(){ for(i=1;i<=n;i++) { if(!unit[i].f) return 1; } return 0;}int main(){ scanf("%d",&T); while(T--) { scanf("%d%d%d%d%d",&n,&s,&x,&y,&mod); for(int e=1; e<=n; e++) { //getchar(); // gets(ss); // int a1,a2,a3,a4; // char c1[100],c2[100]; /* for(i=0; i<250; i++) { if(ss[i]=='m') a1=i; if(ss[i]=='r') a2=i; if(ss[i]=='t') a3=i; if(ss[i]=='p') a4=i; if(ss[i]=='g') break; } int la=a2-a1-2;//1 int lb=a4-a3-3;//1 for(i=0; i<la; i++) { c1[i]=ss[a1+i+1]-'0'; } c1[i]='\0'; for(i=0; i<lb; i++) { c2[i]=ss[a3+2+i]-'0'; } c2[i]='\0'; int h1=0; int h2=0; for(i=0; i<la; i++) { h1=h1+c1[i]*pow(10,la-i-1); } //printf("hhhh%d\n",h1); for(i=0; i<lb; i++) { h2=h2+c2[i]*pow(10,lb-i-1); } unit[e].x=h2; unit[e].y=h1; unit[e].f=0;*/ scanf("%s request %d pages",unit[e].name,&unit[e].x); // printf("%s %d\n",unit[e].name,unit[e].x); unit[e].f=0; } // int flag=1; i=1; /* for(i=1;i<=n;i++) { printf("%s %d %d\n",unit[i].name,unit[i].x,unit[i].f); }*/ int cnt=s; while(judge()) { //h4=unit[i].x;//team //h3=unit[i].x;//page //printf("fjkdsjf"); if(cnt>=unit[i].x) { cnt=cnt-unit[i].x; //flag=1; unit[i].f=1; //printf("fjdskl"); printf("%d pages for %s\n",unit[i].x,unit[i].name); i++;//进入到下一组 } else { //flag=0; printf("%d pages for %s\n",cnt,unit[i].name); s=(s*x+y)%mod; /*if(s==0) { s=(s*x+y)%mod; }*/ cnt=s; } } printf("\n"); } return 0;} /**************************************Problem id: SDUT OJ 2624 User name: persue Result: Accepted Take Memory: 472K Take Time: 0MS Submit Time: 2014-02-25 20:26:40 **************************************/
- 第四届省赛试题 模拟 Contest Print Server
- sdut 2624 Contest Print Server (第四届省赛)
- 第四届 Contest Print Server
- 第四届 山东省ACM Contest Print Server
- 山东省第四届ACM省赛题——Contest Print Server(模拟)
- 山东省第四届ACM大学生程序设计竞赛-Contest Print Server(模拟)
- sdut 2624 Contest Print Server (模拟)
- UPC:2226 Contest Print Server(模拟)
- 第四届山东ACM省赛---Contest Print Server
- 2013山东省第四届ACM省赛 Contest Print Server
- [2013山东ACM省赛] Contest Print Server (模拟)
- hrbust/哈理工oj Contest Print Server【模拟】
- UPC2226: Contest Print Server
- Contest Print Server 水题
- Problem J:Contest Print Server
- sdut 2624 Contest Print Server
- 2013年山东省第四届ACM大学生程序设计竞赛-最后一道大水题:Contest Print Server
- sdut2624 Contest Print Server (大水+大坑)山东省第四届ACM省赛
- C++0x
- 运动员分组问题
- 【Android开发那点破事】Android调试安装出现2个或2个以上图标
- My working day !
- nginx搭建flv、mp4流媒体服务器
- 第四届省赛试题 模拟 Contest Print Server
- 判树!
- X86汇编中常见的寄存器汇总
- 用win32 API监听U盘插拔并取得其盘符/取得当前插入U盘的盘符
- 关于统计变换(CT/MCT/RMCT)算法的学习和实现
- 【ibokan】表单<Form>元素的一些简单实现代码
- Linux基本命令之linux cd命令详解
- 1.java的package的理解只见
- jquery选择器操作一