답안 #2207

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
2207 2013-07-20T09:48:04 Z jwvg0425 생일수 II (GA4_birthday2) C++
10 / 100
1000 ms 1324 KB
#include<stdio.h>
int x,y;
int num[8];
int NumTo()
{
	int n=0,i,j=1;
	for(i=0;num[i]!=0;i++,j*=10)
	{
		n=n+j*num[i];
	}
	return n;
}
void add2(int idx)
{	
	if(num[idx]==8)
	{
		num[idx]=3;
		add2(idx+1);
	}
	else if(num[idx]==5)num[idx]=8;
	else if(num[idx]==3)num[idx]=5;
	else if(num[idx]==0)num[idx]=3;

}
void add()
{
	add2(0);
}

int main()
{
	int i=0,a,b=0;
	long long int s=0;
	scanf("%d %d",&x,&y);
	a=x;
	for(;x;x/=10)
	{
		num[i++]=x%10;
	}
	i=0;
	for(;b!=y;)
	{
		add();
		b=NumTo();
		s=(s+(long long int)a*b)%19980305;
		a=b;
	}
	printf("%lld",s);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 884 KB Output is correct
2 Correct 0 ms 884 KB Output is correct
3 Correct 0 ms 884 KB Output is correct
4 Correct 0 ms 884 KB Output is correct
5 Correct 0 ms 884 KB Output is correct
6 Correct 0 ms 884 KB Output is correct
7 Correct 0 ms 884 KB Output is correct
8 Correct 0 ms 884 KB Output is correct
9 Correct 0 ms 884 KB Output is correct
10 Correct 0 ms 884 KB Output is correct
11 Correct 0 ms 884 KB Output is correct
12 Correct 0 ms 884 KB Output is correct
13 Correct 0 ms 884 KB Output is correct
14 Correct 0 ms 884 KB Output is correct
15 Correct 0 ms 884 KB Output is correct
16 Correct 0 ms 884 KB Output is correct
17 Correct 0 ms 884 KB Output is correct
18 Correct 0 ms 884 KB Output is correct
19 Correct 0 ms 884 KB Output is correct
20 Correct 0 ms 884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 0 KB Program timed out
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1316 KB Output isn't correct
2 Halted 0 ms 0 KB -