結果

問題 No.358 も~っと!門松列
ユーザー ontama_12ontama_12
提出日時 2016-10-03 10:35:02
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 1,032 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 38,784 KB
最終ジャッジ日時 2024-04-21 01:38:49
合計ジャッジ時間 2,488 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
38,400 KB
testcase_01 AC 55 ms
38,656 KB
testcase_02 AC 56 ms
38,528 KB
testcase_03 AC 57 ms
38,656 KB
testcase_04 AC 58 ms
38,528 KB
testcase_05 AC 61 ms
38,784 KB
testcase_06 AC 58 ms
38,528 KB
testcase_07 AC 63 ms
38,528 KB
testcase_08 WA -
testcase_09 AC 57 ms
38,784 KB
testcase_10 AC 56 ms
38,528 KB
testcase_11 AC 57 ms
38,656 KB
testcase_12 AC 57 ms
38,528 KB
testcase_13 AC 57 ms
38,400 KB
testcase_14 AC 58 ms
38,784 KB
testcase_15 AC 56 ms
38,528 KB
testcase_16 AC 57 ms
38,400 KB
testcase_17 AC 57 ms
38,400 KB
testcase_18 AC 59 ms
38,528 KB
testcase_19 AC 58 ms
38,784 KB
testcase_20 AC 59 ms
38,528 KB
testcase_21 AC 56 ms
38,528 KB
testcase_22 AC 56 ms
38,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

 ///////////////////////////// 	No.358 も~っと!門松列
    //入力文字読み取り
   var inputall = require('fs').readFileSync('/dev/stdin', 'utf8');

    //すべて受け取り改行で区切って格納
   var input = inputall.split(" ");

   var a1 = Number(input[0]);
   var a2 = Number(input[1]);
   var a3 = Number(input[2]);

    //最大値、最小値を求める
   var max = Math.max(a1, a2, a3);
   var min = Math.min(a1, a2, a3);

   var result = 0;
   if (max == a2 || min == a2) {
       if (a1 != a3) {
           result = "INF";
       }
     
   } else {
       var count = 0;
     var  max_ac = Math.max(a1,a3) 
     for (var i = 1; i <= max_ac; i++) {
         var b1 = a1 % i;
         var b2 = a2 % i
         var b3 = a3 % i

         var  max_b = Math.max(b1,b2,b3);
         var  min_b = Math.min(b1,b2,b3);

         if (max_b == b2 || min_b == b2) {
             if (b1 != b2 && b1 != b3 && b2 != b3) {
                 result++
             } 
         }
     }
   }
    console.log(result)
0