• 个人简介

    #include<bits/stdc++.h> using namespace std; int n,h,a[100005],b[100005],maxa,maxb,ans; int ansa,ansb; int main(){ cin >> n >> h; for(int i = 1;i <= n;i++) { cin >> a[i] >> b[i]; maxa=max(maxa,a[i]); maxb=max(maxb,b[i]); if(a[i]maxa) ansa=i; if(b[i]maxb) ansb=i; } int die=0; while(h>0) { if(maxa<maxb) { if(dien-1) { h-=maxa; continue; } h-=maxb; die++; maxb=0; for(int i = 1;i <= n;i++) { if(i!=ansb) maxb=max(b[i],maxb); else b[i]=0; } if(ansbansa) { for(int i = 1;i <= n;i++) { if(i!=ansa) maxa=max(a[i],maxa); else a[i]=0; } } for(int i = 1;i <= n;i++) { if(b[i]==maxb) ansb=i; if(a[i]==maxa) ansa=i; } } else { h-=maxa; } ans++; } cout << ans; return 0; }

  • 最近活动

    This person is lazy and didn't join any contests or homework.
  • 最近编写的题解

    This person is lazy and didn't write any solutions.