记录编号 | 65166 | 评测结果 | AAAAAW | ||
---|---|---|---|---|---|
题目名称 | [暑假培训2012] 黑叔 | 最终得分 | 83 | ||
用户昵称 | 是否通过 | 未通过 | |||
代码语言 | C++ | 运行时间 | 0.031 s | ||
提交时间 | 2013-07-25 16:58:58 | 内存使用 | 0.43 MiB | ||
#include <string> #include <algorithm> #include <fstream> using namespace std; ifstream input ("hey.in"); ofstream output ("hey.out"); int a,b,c=0; class hey { public: int a; int b; string c; }heys[10001]; bool cmp(hey x,hey y) { return (x.a<y.a); } int main () { int i; input>>b; for(i=1;i<=b;i++) { input>>heys[i].a>>heys[i].c>>heys[i].b; } sort(heys+1,heys+1+b,cmp); for(i=1;i<=b;i++) { if(heys[i+1].a<heys[i].a+heys[i].b) heys[i+1].a=heys[i].a+heys[i].b; output<<heys[i].c<<" went out at time "<<heys[i].a<<endl; } input.close(); output.close(); return 0; }