제출 #147611

#제출 시각아이디문제언어결과실행 시간메모리
147611yoni천사의 모래시계 (FXCUP3_hourglass)C++11
58 / 100
2 ms396 KiB
#include <iostream>

int main() {
	int N;
	scanf("%d", &N);
	int cnt5 = N/5;
	N -= cnt5 * 5;
	int cnt3 = -1;
	while (cnt5 >= 0) {
		if (N % 3 == 0) {
			cnt3 = N / 3;
			break;
		}
		cnt5--;
		N += 5;
	}
	printf("%d", cnt3==-1?-1:cnt3+cnt5);
	
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

hourglass.cpp: In function 'int main()':
hourglass.cpp:5:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...