結果

問題 No.796 well known
ユーザー heyanxxheyanxx
提出日時 2019-07-04 17:33:28
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,041 bytes
コンパイル時間 3,779 ms
コンパイル使用メモリ 77,548 KB
実行使用メモリ 66,704 KB
最終ジャッジ日時 2023-10-19 07:42:10
合計ジャッジ時間 15,896 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 143 ms
57,700 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package test.demo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Yukicoder796 {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int[] array=new int[N];
		int a=0;
		int multiple=0;
		int sum=0;
		while(true) {
		for(int i=0;i<N;i++) {
			if(a!=0) {
			 a=(int) (Math.random()*(312456/(3*a)));
			}else {
				a=(int) (Math.random()*(312456/3));
			}
			array[i]=a;
			sum+=array[i];
			multiple*=array[i];
		 }
		if((sum-1)%3==0 && multiple%3==0) {
			for(int i=0;i<N;i++) {
			if(i!=N-1) {
				System.out.print(array[i]);
				System.out.print(" ");
			}else {
				System.out.println(array[i]);
			}
			}
			return;
		}
		}
	}

	public static  String[] input() throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
		
		String str=br.readLine();
		String[]str2=str.split(" ");
		
		return str2;
	}
}
0