結果

問題 No.36 素数が嫌い!
ユーザー alpha_virginisalpha_virginis
提出日時 2015-03-10 23:22:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,291 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 70,052 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-06 23:02:33
合計ジャッジ時間 1,924 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 2 ms
4,384 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <math.h>

#include <iostream>
#include <vector>
#include <list>
#include <algorithm>

int main() {

  /* default begin */
  long i, j, k;
  long n, m;
  long temp;
  long t[16] = {};
  std::vector<long> v;
  bool b;
  /* default end */

  long N;

  std::cin >> N;

  switch(N) {
  case 0:
    return 0;  
  case 1:
    std::cout << "NO" << std::endl;
    return 0;
  case 2:
    std::cout << "NO" << std::endl;
    return 0;
  case 3:
    std::cout << "NO" << std::endl;
    return 0;
  case 4:
    std::cout << "NO" << std::endl;
    return 0;
  }
  
  b = false;

  t[0] = N;
  //std::cout << t[0] << std::endl;
  for(i = 0; i < 100; i++) {
    t[0] = ((2*t[0]/3+1) + (((N/(3*t[0]))+1)/t[0]+1));
    //std::cout << t[0] << std::endl;
  }

  i = 2;
  for(;;) {
    if( (N % i) == 0 ) {
      v.push_back(i);
      if( v.size() >= 3 ) {
	b = true;
	  goto label_1;
      }
      N /= i;
    }
    else {
      break;
    }
  }

  for(i = 3; i <= t[0]; i+=2) {
    for(;;) {
      if( (N % i) == 0 ) {
	v.push_back(i);
	if( v.size() >= 3 ) {
	  b = true;
	  goto label_1;
	}
	N /= i;
      }
      else {
	break;
      }
    }
  }

 label_1:
  
  if( b ) {
    std::cout << "YES" << std::endl;
  }
  else {
    std::cout << "NO" << std::endl;
  }

  return 0;
}

0