10 条题解

  • 4
    @ 2024-3-17 10:00:53
    #include <bits/stdc++.h>
    using namespace std;
    int s=-100001,j=100001;
        int main(){
        int n,m; cin>>n;
        for(int i=1;i<=n;i++){
        cin>>m; if(m>=s){
        s=m; }if(m<=j){ j=m;
              }
          }
        cout<<j<<" "<<s;
        return 0;
    }
    
    • 1
      @ 2024-4-6 20:32:12
      #include <bits/stdc++.h>
      using namespace std;
      int a=-100001,b=100001;
          int main(){
          int n,x;
          cin>>n;
          for(int i=1;i<=n;i++){
              cin>>x;
              if(x>=a){
                  a=x;
              }
              if(x<=b){
                  b=x;
              }
          }
          cout<<b<<" "<<a;
          return 0;
      }
      
      • 1
        @ 2024-3-24 11:18:54
        #include<bits/stdc++.h>
        using namespace std;
        int main(){
        	int a[1001],min,n,max;
        	cin>>n;
        	for(int i=1;i<=n;i++)
        	cin>>a[i];
        	min=a[1];
        	max=a[1];
        	for(int i=2;i<=n;i++)
        	if(min>a[i]){
        		min=a[i];
        	}
        	for(int i=2;i<=n;i++)
        	if(max<a[i]){
        		max=a[i];
        	}
        	cout<<min<<" "<<max;
        	return 0; 
        }
        
        • 1
          @ 2024-3-17 10:45:04
          #include <bits/stdc++.h>
          using namespace std;
          int s=-100001,j=100001;
              int main(){
              int n,m; cin>>n;
              for(int i=1;i<=n;i++){
              cin>>m; if(m>=s){
              s=m; }if(m<=j){ j=m;
                    }
                }
              cout<<j<<" "<<s;
              return 0;
          }
          
          • 1
            @ 2024-3-17 10:38:52

            #include<bits/stdc++.h> using namespace std; int main(){ int i,n,x,max,min; cin>>n; cin>>x; max=x; min=x; for(i=2;i<=n;i++){ cin>>x; if(x>max){ max=x; } else if(x<min){ min=x; } } cout<<min<<" "<<max; return 0; }

            • 1
              @ 2024-3-17 9:54:25
              #include <bits/stdc++.h>
              using namespace std;
              int s=-100001,j=100001;
                  int main(){
                  int n,m; cin>>n;
                  for(int i=1;i<=n;i++){
                  cin>>m; if(m>=s){
                  s=m; }if(m<=j){ j=m;
                        }
                    }
                  cout<<j<<" "<<s;
                  return 0;
              }
              
              • 1
                @ 2024-2-21 9:15:01

                #include <bits/stdc++.h> using namespace std; int s=-100001,j=100001; int main(){ int n,m; cin>>n; for(int i=1;i<=n;i++){ cin>>m; if(m>=s){ s=m; }if(m<=j){ j=m; } } cout<<j<<" "<<s; return 0; }

                • 0
                  @ 2024-4-14 10:21:39
                  #include<bits/stdc++.h> 
                  using namespace std; 
                  int main(){ 
                      int i,n,x,max,min; 
                      cin>>n; 
                      cin>>x; 
                      max=x; 
                      min=x; 
                      for(i=2;i<=n;i++){ 
                          cin>>x; 
                          if(x>max){ 
                              max=x; } 
                          else 
                              if(x<min){ 
                                  min=x; } 
                      } cout<<min; 
                  }
                  
                  • -1
                    @ 2024-3-17 10:00:57
                    #include <bits/stdc++.h>
                    using namespace std;
                    int s=-100001,j=100001;
                        int main(){
                        int n,m; cin>>n;
                        for(int i=1;i<=n;i++){
                        cin>>m; if(m>=s){
                        s=m; }if(m<=j){ j=m;
                              }
                          }
                        cout<<j<<" "<<s;
                        return 0;
                    }
                    
                    • -1
                      @ 2024-3-17 9:41:57

                      #include <bits/stdc++.h> using namespace std; int s=-100001,j=100001; int main(){ int n,m; cin>>n; for(int i=1;i<=n;i++){ cin>>m; if(m>=s){ s=m; }if(m<=j){ j=m; } } cout<<j<<" "<<s; return 0; }

                      • 1

                      信息

                      ID
                      2140
                      时间
                      1000ms
                      内存
                      256MiB
                      难度
                      2
                      标签
                      递交数
                      317
                      已通过
                      201
                      上传者