2 solutions

  • 0
    @ 2025-6-22 14:58:41
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	int last=-1;
    	for(int i=1;i<=n;i++)
    	{
    		int x;
    		cin>>x;
    		if(x>last) //持续上升 
    		{
    			last=x;
    		} 
    		else //无法移动了 
    		{
    			break;
    		}
    	}
    	cout<<last;
    	return 0;
    }
    
    • 0
      @ 2025-6-21 9:58:47
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          bool jud=true;
          int n,now;
          cin>>n;
          for(int i=1;i<=n;i++)
          {
              int x;
              cin>>x;
              if(i==1) now=x;
              else
              {
                  if(x>now && jud) now=x;
                  else jud=false;
              }
          }
          cout<<now;
          return 0;
      }
      
      • 1

      Information

      ID
      2333
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      1
      Tags
      (None)
      # Submissions
      48
      Accepted
      18
      Uploaded By