| 记录编号 | 40677 | 评测结果 | AAAAAA | 
    
        | 题目名称 | 935.[暑假培训2012] 黑叔 | 最终得分 | 100 | 
    
        | 用户昵称 |  日光。 | 是否通过 | 通过 | 
    
        | 代码语言 | C++ | 运行时间 | 0.035 s | 
    
        | 提交时间 | 2012-07-18 16:12:31 | 内存使用 | 0.77 MiB | 
    
    
    
    		显示代码纯文本
		
		#include<algorithm>
#include<iostream>
#include<fstream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
struct node
{
    int T,d;
    char name[40];
}number[10010];
int n,t;
inline int cmp(node x,node y)
{
	if(x.T==y.T) return strcmp(x.name,y.name)<0;
	return x.T<y.T;
}
int main()
{
	ifstream fin("hey.in");
	ofstream fout("hey.out");
    fin>>n;
    for(int i=0;i<n;i++) fin>>number[i].T>>number[i].name>>number[i].d;
    sort(number,number+n,cmp);
    t=number[0].T;
    for(int i=0;i<n;i++)
	{
        if(number[i].T<=t)
		{
            fout<<number[i].name<<" went out at time "<<t<<endl;
            t+=number[i].d;
        }
		else
		{
           fout<<number[i].name<<" went out at time "<<number[i].T<<endl;
		   t=number[i].d+number[i].T;
        }
    }
    return 0;
}