結果

問題 No.199 星を描こう
ユーザー TatamoTatamo
提出日時 2016-11-15 18:03:50
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 1,393 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 6,948 KB
実行使用メモリ 41,580 KB
最終ジャッジ日時 2024-04-21 01:39:20
合計ジャッジ時間 3,153 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
39,168 KB
testcase_01 AC 65 ms
39,424 KB
testcase_02 AC 64 ms
39,168 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 AC 65 ms
39,296 KB
testcase_15 AC 66 ms
39,168 KB
testcase_16 AC 66 ms
39,296 KB
testcase_17 AC 64 ms
39,040 KB
testcase_18 AC 64 ms
41,336 KB
testcase_19 AC 63 ms
39,424 KB
testcase_20 AC 65 ms
39,168 KB
testcase_21 WA -
testcase_22 AC 64 ms
39,424 KB
testcase_23 AC 64 ms
39,296 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 65 ms
39,168 KB
testcase_27 AC 64 ms
39,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

var input = require("fs").readFileSync("/dev/stdin", "utf8");
input = input.split("\n");
var point = [];
for (var i = 0; i < 5; i++) {
    var tmp = input[i].split(" ");
    point.push([+tmp[0], +tmp[1]]);
}
var count = 0; // 条件を満たす2点の組の数
for (var p1 = 0; p1 < 5; p1++) {
    for (var p2 = 0; p2 < 5; p2++) {
        if (p1 == p2)
            continue;
        var flg = true;
        var cnt_p = 0; // +
        var cnt_m = 0; // -
        for (var p3 = 0; p3 < 5; p3++) {
            if (p3 == p1 || p3 == p2)
                continue;
            var dx1 = point[p2][0] - point[p1][0];
            var dy1 = point[p2][1] - point[p1][1];
            var dx2 = point[p3][0] - point[p1][0];
            var dy2 = point[p3][1] - point[p1][1];
            var deg1 = Math.atan2(dy1, dx1);
            var deg2 = Math.atan2(dy2, dx2);
            var deg = (deg2 - deg1);
            if ((deg * 180 / Math.PI) % 180 == 0) {
                flg = false;
                break;
            }
            else if (deg > 0)
                cnt_p += 1;
            else if (deg < 0)
                cnt_m += 1;
        }
        if (cnt_p == 2 && cnt_m == 1 ||
            cnt_p == 1 && cnt_m == 2) {
        }
        else {
            flg = false;
        }
        if (flg)
            count += 1;
    }
}
if (count == 10)
    console.log("YES");
else
    console.log("NO");
0