-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProblem-56.nb
95 lines (86 loc) · 2.89 KB
/
Problem-56.nb
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
82
83
84
85
86
87
88
89
90
91
92
93
94
(* Content-type: application/mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 7.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 145, 7]
NotebookDataLength[ 2769, 85]
NotebookOptionsPosition[ 2445, 69]
NotebookOutlinePosition[ 2788, 84]
CellTagsIndexPosition[ 2745, 81]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"ans", " ", "=", " ", "0"}], ";"}], "\[IndentingNewLine]",
RowBox[{"For", "[",
RowBox[{
RowBox[{"i", " ", "=", " ", "1"}], " ", ",", " ",
RowBox[{"i", " ", "<", " ", "100"}], " ", ",", " ",
RowBox[{"i", " ", "++"}], ",", "\[IndentingNewLine]",
RowBox[{"For", "[",
RowBox[{
RowBox[{"j", "=", "1"}], " ", ",", " ",
RowBox[{"j", " ", "<", " ", "100"}], " ", ",", " ",
RowBox[{"j", " ", "++"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"temp", " ", "=", " ",
RowBox[{"DigitCount", "[",
RowBox[{"i", "^", "j"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"ret", " ", "=", " ", "0"}], ";", "\[IndentingNewLine]",
RowBox[{
RowBox[{"For", "[",
RowBox[{
RowBox[{"k", " ", "=", " ", "1"}], ",", " ",
RowBox[{"k", " ", "\[LessEqual]", " ", "9"}], " ", ",", " ",
RowBox[{"k", " ", "++"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"ret", " ", "=", " ",
RowBox[{"ret", " ", "+", " ",
RowBox[{
RowBox[{"temp", "[",
RowBox[{"[", "k", "]"}], "]"}], " ", "*", " ", "k"}]}]}],
";"}]}], "\[IndentingNewLine]", "]"}], "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"ret", " ", ">", " ", "ans"}], " ", ",", " ",
RowBox[{"ans", " ", "=", " ", "ret"}]}], "]"}]}], ";"}]}],
"\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]",
"]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[", "ans", "]"}], ";"}]}], "Input",
CellChangeTimes->{{3.5158188070468936`*^9, 3.5158188966500187`*^9}, {
3.5158190424933605`*^9, 3.515819043925442*^9}}],
Cell[BoxData["972"], "Print",
CellChangeTimes->{
3.515818898210108*^9, {3.515819045072508*^9, 3.5158190513068647`*^9}}]
}, Open ]]
},
WindowSize->{607, 535},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
FrontEndVersion->"7.0 for Microsoft Windows (32-bit) (November 10, 2008)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[567, 22, 1737, 40, 252, "Input"],
Cell[2307, 64, 122, 2, 23, "Print"]
}, Open ]]
}
]
*)
(* End of internal cache information *)