天天看點

ACM輸入

char a[100]
while(gets(a)!='\0')
           
#include<bits/stdc++.h>
using namespace std;
char a[100+5];
int main()
{
    int n;
    scanf("%d",&n);
    getchar();
    while(n--)
    {
        gets(a);
    }
    return 0;
}
           

java

樣例:

2

5 1 2 3 4 5

6 1 2 3 4 5 6

import java.util.Scanner;

public class welcome {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in);
		while (input.hasNext()) {
			int t = input.nextInt();// 有幾組資料
			while (t-- > 0) {
				int n = input.nextInt();
				int[] a = new int[10000];
				for (int i = 0; i < n; i++) {
					a[i] = input.nextInt();
				}
			}
		}
	}
}