結果
問題 | No.199 星を描こう |
ユーザー | kou6839 |
提出日時 | 2015-04-30 22:36:43 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 127 ms / 2,000 ms |
コード長 | 1,877 bytes |
コンパイル時間 | 3,118 ms |
コンパイル使用メモリ | 76,432 KB |
実行使用メモリ | 56,412 KB |
最終ジャッジ日時 | 2023-08-28 18:39:15 |
合計ジャッジ時間 | 7,106 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
55,972 KB |
testcase_01 | AC | 121 ms
55,884 KB |
testcase_02 | AC | 119 ms
55,516 KB |
testcase_03 | AC | 119 ms
55,688 KB |
testcase_04 | AC | 119 ms
56,412 KB |
testcase_05 | AC | 120 ms
55,772 KB |
testcase_06 | AC | 119 ms
55,888 KB |
testcase_07 | AC | 120 ms
55,800 KB |
testcase_08 | AC | 120 ms
56,244 KB |
testcase_09 | AC | 119 ms
55,844 KB |
testcase_10 | AC | 120 ms
55,816 KB |
testcase_11 | AC | 120 ms
56,100 KB |
testcase_12 | AC | 120 ms
56,236 KB |
testcase_13 | AC | 119 ms
55,960 KB |
testcase_14 | AC | 121 ms
56,088 KB |
testcase_15 | AC | 120 ms
55,656 KB |
testcase_16 | AC | 127 ms
55,636 KB |
testcase_17 | AC | 125 ms
55,736 KB |
testcase_18 | AC | 127 ms
55,716 KB |
testcase_19 | AC | 125 ms
55,484 KB |
testcase_20 | AC | 126 ms
55,748 KB |
testcase_21 | AC | 126 ms
55,992 KB |
testcase_22 | AC | 125 ms
55,732 KB |
testcase_23 | AC | 118 ms
56,272 KB |
testcase_24 | AC | 120 ms
56,032 KB |
testcase_25 | AC | 118 ms
56,292 KB |
testcase_26 | AC | 119 ms
55,936 KB |
testcase_27 | AC | 124 ms
55,980 KB |
ソースコード
import java.util.ArrayList; import java.util.Scanner; public class Main { static boolean cul(int[] x,int []y, ArrayList<Integer> use,ArrayList<Integer> not){ int one = (x[use.get(1)]-x[use.get(0)])*(y[not.get(0)]-y[use.get(0)])-(y[use.get(1)]-y[use.get(0)])*(x[not.get(0)]-x[use.get(0)]); int two = (x[use.get(2)]-x[use.get(1)])*(y[not.get(0)]-y[use.get(1)])-(y[use.get(2)]-y[use.get(1)])*(x[not.get(0)]-x[use.get(1)]); int three=(x[use.get(0)]-x[use.get(2)])*(y[not.get(0)]-y[use.get(2)])-(y[use.get(0)]-y[use.get(2)])*(x[not.get(0)]-x[use.get(2)]); if((one>0 && two >0 && three >0 )||(one<0 && two <0 && three <0) || one==0 || two ==0 || three==0){ return false; }else{ } one = (x[use.get(1)]-x[use.get(0)])*(y[not.get(1)]-y[use.get(0)])-(y[use.get(1)]-y[use.get(0)])*(x[not.get(1)]-x[use.get(0)]); two = (x[use.get(2)]-x[use.get(1)])*(y[not.get(1)]-y[use.get(1)])-(y[use.get(2)]-y[use.get(1)])*(x[not.get(1)]-x[use.get(1)]); three=(x[use.get(0)]-x[use.get(2)])*(y[not.get(1)]-y[use.get(2)])-(y[use.get(0)]-y[use.get(2)])*(x[not.get(1)]-x[use.get(2)]); if((one>0 && two >0 && three >0 )||(one<0 && two <0 && three <0) || one==0 || two ==0 || three==0){ return false; }else{ } return true; } public static void main(String[] args){ // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int[] x = new int[5]; int[] y = new int[5]; for(int i=0;i<5;i++){ x[i]=sc.nextInt(); y[i]=sc.nextInt(); } for(int i=0; i< (1<<5);i++){ if(Integer.bitCount(i)!=3) continue; ArrayList<Integer> use = new ArrayList<>(); ArrayList<Integer> not = new ArrayList<>(); for(int j=0;j<5;j++){ if((i >> j &1) >0){ use.add(j); }else{ not.add(j); } } if(!cul(x, y, use, not)){ System.out.println("NO"); return; } } System.out.println("YES"); } }