zoukankan      html  css  js  c++  java
  • 两个递增数据组合成一个递增数据(不适用)

    public class ListArrayApp {

    public static void main(String[] args) {

    int[] a = { 1, 3, 5 };
    int[] b = { 2, 6 };
    int l = a.length + b.length;
    int[] c = new int[l];
    int i = 0, j = 0, k = 0;

    while (i < a.length && j <= b.length) {
    if (a[i] < b[j]) {
    c[k] = a[i];
    i++;
    } else {
    c[k] = b[j];
    j++;
    }
    k++;
    }
    if(a[a.length-1]<b[b.length-1]){
    c[c.length-1]= b[b.length-1];
    }else{
    c[c.length-1]=a[a.length-1];
    }
    for (int m : c) {
    System.out.print(m+" ");
    }
    }
    }

  • 相关阅读:
    bzoj1098 1301
    bzoj3237
    bzoj3170
    bzoj4008
    一些题解
    bzoj4028
    bzoj3196
    redis学习
    quartz学习
    电商618 压测、优化、降级预案
  • 原文地址:https://www.cnblogs.com/qadyyj/p/5488866.html
Copyright © 2011-2022 走看看