Submission #305608
Source Code Expand
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define reps(i,f,n) for(int i=f; i<int(n); ++i) #define rep(i,n) reps(i,0,n) typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pii; int pow(int n) { int ans = 1; rep(i, n) ans *= 10; return ans; } void func(string& str, int pos, int n) { if(pos == n){ cout << str << endl; return; } rep(i, 10){ func(str, pos+1, n); if(i < 9){ str[pos]++; if(str[pos] == '9'+1) str[pos] = '0'; } } } int main() { int n; cin >> n; int N = pow(n); cout << N-1 << endl; string str(n, '0'); func(str, 0, n); }
Submission Info
Submission Time | |
---|---|
Task | A - Lock |
User | natrium |
Language | C++ (G++ 4.6.4) |
Score | 100 |
Code Size | 909 Byte |
Status | AC |
Exec Time | 240 ms |
Memory | 808 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
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 | 23 ms | 808 KB |
subtask0_sample_02.txt | AC | 24 ms | 720 KB |
subtask1_01.txt | AC | 27 ms | 804 KB |
subtask1_02.txt | AC | 49 ms | 804 KB |
subtask1_03.txt | AC | 240 ms | 804 KB |