Submission #305632


Source Code Expand

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;
int a[5], b[5];
int main() {
	int n;
	int i, j, k;
	int ans = 1;
	scanf("%d", &n);
	for (i = 0; i < n; ++i)
		ans *= 10;
	for (i = 0; i < n; ++i) {
		a[i] = 0;
		b[i] = 1;
	}
	ans -= 1;
	printf("%d\n", ans);
	for (i = 0; i <= ans; ++i) {
		for (j = n - 1; j >= 0; --j) {
			printf("%d", a[j]);
		}
		printf("\n");
		a[0] += b[0];
		if (a[0] == 10 || a[0] == -1) {
			b[0] = -b[0];
			a[0] += b[0];
			a[1] += b[1];
			if (a[1] == 10 || a[1] == -1) {
				b[1] = -b[1];
				a[1] += b[1];
				a[2] += b[2];
				if (a[2] == 10 || a[2] == -1) {
					b[2] = -b[2];
					a[2] += b[2];
					a[3] += b[3];
					if (a[3] == 10 || a[3] == -1) {
						b[3] = -b[3];
						a[3] += b[3];
						a[4] += b[4];
					}
				}
			}
		}
	}
	return 0;
}

Submission Info

Submission Time
Task A - Lock
User asian-2014-1511
Language C++ (G++ 4.6.4)
Score 100
Code Size 1143 Byte
Status AC
Exec Time 90 ms
Memory 800 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:26:17: 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 26 ms 700 KB
subtask1_01.txt AC 37 ms 700 KB
subtask1_02.txt AC 29 ms 800 KB
subtask1_03.txt AC 90 ms 748 KB