egin: 2020-08-13 22:00 UTC+7
 S4: Competitive Programming 101
End: 2020-08-14 19:00 UTC+7
04:55:21
Elapsed: 04:55:21RunningRemaining: 16:04:38
Overview
Problem
Status
Rank (04:55:16)
0 Comments
Previous12345…Next
Username
Prob
	Result
	Time
(ms)	Mem
(MB)	Lang
	Submit Time
hans0221
F
Wrong Answer
C
9 min ago
hans0221
F
Wrong Answer
C
15 min ago
hans0221
F
Wrong Answer
C
20 min ago
hans0221
F
Compilation Error
C
20 min ago
hans0221
F
Wrong Answer
C
29 min ago
hans0221
F
Wrong Answer
C
34 min ago
hans0221
F
Wrong Answer
C
35 min ago
hans0221
F
Wrong Answer
C
36 min ago
hans0221
F
Wrong Answer
C
37 min ago
hans0221
F
Wrong Answer
C
42 min ago
hans0221
F
Wrong Answer
C
46 min ago
hans0221
F
Wrong Answer
C
1 hr ago
hans0221
F
Wrong Answer
C
1 hr ago
hans0221
F
Wrong Answer
C
1 hr ago
hans0221
F
Wrong Answer
C
2 hr ago
hans0221
F
Wrong Answer
C
2 hr ago
hans0221
F
Wrong Answer
C
2 hr ago
hans0221
F
Wrong Answer
C
2 hr ago
hans0221
F
Wrong Answer
C
2 hr ago
hans0221
F
Wrong Answer
C
3 hr ago
     
All Copyright Reserved © 2010-2020 Xu Han
Server Time: 2020-08-14 02:55:20 UTC+7

#26819165 | hans0221's solution for [Problem F]
Status
Wrong Answer
Length
755
Lang
C (Clang 10.0.0)
Submitted
2020-08-14 02:25:12
Shared

24.0 / 25.0
Select Code
#include<stdio.h>
int main()	
{
	long long tc;
	scanf("%lld",&tc);
	long long input[tc+1];
	long long total = 1;
	int flag = 1;
	int flag2 = 0;
	long long sementara;
	int countO = 0,countzero = 0;
	for(int i = 0;i<tc;i++)
	{
		scanf("%lld",&input[i]);
		total *= input[i];
		sementara = input[i];
		while(sementara != 0)
		{
			if(sementara % 10 == 0) countO++;
			if(sementara > 9) countzero++;
			sementara /= 10;
		}
		if(total >1000000000000000000 || total < 0)
		{
		 	flag = 0;
		}
		if(countO > 18 || countzero >= 18)
		{
			flag = 0;
		}
		if(input[i] == 0)
		{
			flag2 = 1;
		}
	}
	if(flag2 == 1) printf("0\n");
	else if(flag == 0) printf("-1\n");
	else if(total > 1000000000000000000 || total < 0) printf("-1\n");
	else printf("%lld\n",total);
	return 0;
}	