C言語で2分探索法のコードを作成し、コンパイルをしました。しかしZEROスーパーセキュリティにウイルスと判断されexeファイルを隔離フォルダに移動させられてしまいました。
コード少しを書き換えてコンパイルをしてみても以下のような文が表示され、コンパイルができません。
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot open output file binarysearch.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
こちらがそのソースコードです。
ウイルス判定されるような書き方をしているのかなど、原因がわかる方がいらっしゃいましたら教えていただけると嬉しいです。
C
#include <stdio.h> int main(void) { int D[16] = {1, 2, 5, 6, 9, 11, 13, 15, 17, 20, 23, 24, 28, 29, 33, 39}; int left = 0; int right = 15; int mid = (left + right) / 2; int count = 0; int x; printf("What is the number that you want to search for?\n"); scanf("%d", &x); while (left < right) { printf("count = %3d \n", ++count); if (D[mid] == x) { printf("%d", mid); return 0; } else if (D[mid] < x) { left = mid + 1; mid = (left + right) / 2; } else { right = mid - 1; mid = (left + right) / 2; } } if (D[mid] == x) { printf("%d", mid); } else { printf("The number does not exist\n"); } return 0; }
まだ回答がついていません
会員登録して回答してみよう