답안 #147615

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
147615 2019-08-30T10:03:15 Z yoni 천사의 모래시계 (FXCUP3_hourglass) C++11
100 / 100
2 ms 420 KB
#include <iostream>

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

Compilation message

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);
  ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 396 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 392 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 396 KB Output is correct
5 Correct 2 ms 356 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 420 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 392 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 400 KB Output is correct
7 Correct 2 ms 368 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 360 KB Output is correct
10 Correct 2 ms 420 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 396 KB Output is correct