AcWing 814. 复制数组 - Java
原题链接
简单
作者:
KYCygni
,
2021-03-21 13:33:57
,
所有人可见
,
阅读 290
Java 代码
import java.util.Scanner;
public class Main
{
public static int[] copy (int[] m, int[] n, int size)
{
for (int i = 0; i < size; i ++)
n[i] = m[i];
return n;
}
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int m = cin.nextInt();
int n = cin.nextInt();
int size = cin.nextInt();
int[] a = new int[m];
for (int i = 0; i < m; i ++)
a[i] = cin.nextInt();
int[] b = new int[n];
for (int j = 0; j < n; j ++)
b[j] = cin.nextInt();
copy (a, b, size);
for (int k = 0; k < b.length; k ++)
{
System.out.print (b[k] + " ");
}
}
}