답안 #329267

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
329267 2020-11-20T02:18:32 Z seedkin 일하는 개미 (FXCUP3_ant) C
90 / 100
1 ms 384 KB
#include "ant.h"



#include <stdio.h>

int FindK() {

	int low = 1;

	int high = 100000000;

	int mid = (low + high) / 2;

	int arr[3];	

	while(low != mid) {

		int r = DeliverCount(mid);

		if(r >= 1) {

			if(r == 1) {

				arr[1] = mid;				

			} else {

				arr[2] = mid;			

			}			

			high = mid;

			mid = (low + high) / 2;

		} else {						

			arr[0] = mid;

			low = mid;

			mid = (low + high) / 2;

		}

	}

	

	// printf("%d\n",low);

	// for(int i =0; i< 3; i++) printf("%d ", arr[i]);

	if(arr[2] == 2) return 1;

	return arr[1];

}

Compilation message

ant.c: In function 'FindK':
ant.c:55:4: warning: 'arr[2]' may be used uninitialized in this function [-Wmaybe-uninitialized]
   55 |  if(arr[2] == 2) return 1;
      |    ^
ant.c:15:6: warning: 'arr[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
   15 |  int arr[3];
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 256 KB Partially correct : C = 27
2 Partially correct 0 ms 256 KB Partially correct : C = 27
3 Partially correct 1 ms 256 KB Partially correct : C = 27
4 Partially correct 0 ms 256 KB Partially correct : C = 27
5 Partially correct 1 ms 384 KB Partially correct : C = 27