Submission #305694


Source Code Expand

#include <stdio.h>
int pow10[7];
char number[10],n;
void Print(int k,int o)
{
	if(k>n)
	{
		printf("%s\n",number+1);
		return;
	}
	int i;
	for(i=1; i<=9 ;++i)
	{
		Print(k+1,(i%2)*2-1);
		number[k]+=o;
	}
	Print(k+1,(i%2)*2-1);
}
int main()
{
	int i;
	scanf("%d",&n);
	pow10[0]=1;
	for(i=1;i<7;++i) pow10[i]=pow10[i-1]*10;
	for(i=1; i<=n; ++i) number[i]='0';
	printf("%d\n",pow10[n]-1);
	Print(1,1);
	return 0;
}

Submission Info

Submission Time
Task A - Lock
User asian-2014-1515
Language C++ (G++ 4.6.4)
Score 100
Code Size 440 Byte
Status AC
Exec Time 74 ms
Memory 804 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:22:15: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘char*’ [-Wformat]
./Main.cpp:22:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 5
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt
All subtask0_sample_01.txt, subtask0_sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 22 ms 800 KB
subtask0_sample_02.txt AC 21 ms 708 KB
subtask1_01.txt AC 22 ms 792 KB
subtask1_02.txt AC 23 ms 796 KB
subtask1_03.txt AC 74 ms 804 KB