uva 144
来源:互联网 发布:画设计图的软件 编辑:程序博客网 时间:2024/06/02 01:56
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include <iomanip>
////////
using namespacestd;
struct student
{
int id;
int pay_value;
};
queue<student>queCard;
int main()
{
student s;
int i,j;
int num_of_students,limit;
////////
while (scanf("%d%d",&num_of_students,&limit)==2 && num_of_students && limit)
{
while(!queCard.empty())
{
queCard.pop();
}
/////////
for(i=1;i<=num_of_students;i++)
{
s.id = i;
s.pay_value =0;
queCard.push(s);
}
/////////
while(!queCard.empty())
{
for(i=1;i<=limit;i++)
{
int out_store = i;
while(!queCard.empty() && out_store)
{
s = queCard.front();
queCard.pop();
if(s.pay_value+out_store<40)
{
s.pay_value+=out_store;
out_store = 0;
queCard.push(s);
}
else
{
out_store-=40-s.pay_value;
cout<<setw(3)<<s.id;
}
}
}
}
cout<<endl;
}
}
- uva 144
- uva 144
- UVa 144 - Student Grants
- UVA 144 Student Grants
- uva
- UVA
- UVA
- UVA
- uva
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- uva 144
- java网站架构设计
- centos7.0安装php7.0
- 杭电1002。包括了该题一些常见错误
- 后台开发学习——JSP和JavaBean
- uva 144
- 负载均衡技术
- HDU4791->贪心&&二分优化
- 标记一些基础知识
- [HDU 5147] Sequence II (树状数组+前缀和)
- CSS inline-block与vertical-align的一个问题
- 框架
- Python3.4使用MySQL—Python工具连接MySQL
- iOS 自动释放池Autorelease