Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
332686 黄浙峰老师 【C6-7】看电视-会议安排 C++ 解答错误 0 13 MS 256 KB 462 2025-07-15 10:14:36

Tests(0/1):


#include<bits/stdc++.h> using namespace std; struct hsg{ int si,ei; } sgh[110]; bool cmp(hsg si,hsg ei){ return si.ei<ei.ei; } int main(){ while(1){ int n; cin>>n; if(n==0) break; for(int i=1;i<=n;i++){ cin>>sgh[i].si>>sgh[i].ei; } sort(sgh+1,sgh+n+1,cmp); int x=sgh[1].ei,g=1; for(int i=2;i<=n;i++){ if(sgh[i].si>=x){ g++; x=sgh[i].si; } } cout<<x<<endl; } return 0; }


测评信息: