1 solutions

  • 0
    @ 2025-12-3 16:44:26

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int n,m,a,b,tmp;
    int main()
    {
    	cin>>n>>m;
    	while(n--)
    	{
    		cin>>a>>b;
    		tmp-=a;
    		tmp+=b;
    		if(tmp>m) tmp=m;
    	}
    	cout<<tmp;
        return 0;
    }
    
    • 1

    2021GCOI五年级第四题 公交车上乘客数(1)

    Information

    ID
    910
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    1
    Accepted
    1
    Uploaded By