dovelet 4 단계 다중 반복문
거듭 제곱 테이블 (table)
http://59.23.113.171/30stair/table/table.php?pname=table
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 |
#include <iostream>
using namespace std;
int table[1000];
void split(long long n, int e, int index)
{
long long i;
long long temp = 1, ten = 1;
while( n/ten ) {
ten *= 10;
}
table[index--] = n%10;
for(i = 10; i < ten; i *= 10) {
table[index--] = (n%(i*10))/i;
}
return ;
}
int main(void)
{
int n, e = 0;
long long temp = 1, i;
cin >> n;
for(i = 0; i < 10; i++) {
temp *= n;
}
i = 1;
while(temp/i) {
e++;
i *= 10;
}
e++;
for(i = 1; i < e*11-1; i++) {
if(i > e && i%e == 0) {
cout << i/e-1;
}
else {
cout << " ";
}
}
cout << "10" << endl;
for(i = 2; i <= n; i++) {
for(int k = 0; k <= e*11; k++) {
table[k] = -1;
}
temp = 1;
for(int j = 1; j <= e*11; j++) {
if(j == e) {
table[j] = i;
}
else if(j % e == 0) {
temp *= i;
if(temp >= 10) {
split(temp, e, j);
}
else {
table[j] = temp;
}
}
}
for(int j = 1; j <= e*11; j++) {
if(table[j] < 0) {
cout << " ";
}
else {
cout << table[j];
}
}
cout << endl;
}
return 0;
} |