zoukankan      html  css  js  c++  java
  • 算法训练 最大值与最小值的计算

    算法训练 最大值与最小值的计算  
    时间限制:1.0s   内存限制:512.0MB
        
      输入11个整数,计算它们的最大值和最小值。
    样例输入
    0 1 2 3 4 5 6 7 8 9 10
    样例输出
    10 0
    import java.util.Scanner;
    public class Main {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            Scanner sc=new Scanner(System.in);
            int temp;
            int min=1000000000;
            int max=-1000000;
            for(int i=0;i<11;i++){
                temp=sc.nextInt();
                if(temp>max) max=temp;
                if(temp<min) min=temp;
            }
            System.out.println(max+" "+min);
    
        }
    
    }
  • 相关阅读:
    网络面试题2
    网络
    Linux os
    操作系统面试题2
    操作系统面试题
    Linux
    算法-字符全排列
    第k大数问题
    地址
    ListView里面嵌套CheckBox
  • 原文地址:https://www.cnblogs.com/watchfree/p/5356472.html
Copyright © 2011-2022 走看看