Code Festival C Div and Add
Submit
Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.
Problem
This is an entry for <a href="http://codefestival.jp/">Code Festival</a>. See below for some English.
この問題は <a href="http://recruit-jinji.jp/code_fes2015/short.html">Code Festival 「短縮王」</a>のための問題です。 CODE FESTIVAL本戦参加者の方は、会場で配布されている、ルールブック記載のURLにてご解答ください。
以下問題の原文です
<pre>
C - 割り算と足し算
問題文
正の整数 N が与えられます。N を 1 になるまで約数で割っていって数列を作ります。数列の各要素の各位の和の総和を最大化してください。
例えば、N=12 の場合、12,6,3,1 という数列を作ると 1+2+6+3+1=13 となり、これが最大です。
入力
入力は以下の形式で標準入力から与えられる。
N
整数 N(1≦N≦100) が 1 行で与えられる。
出力
答えを出力せよ。出力の末尾に改行を入れること。
</pre>
これは非公式な本来の問題のコピーです。ゴルフ場の仕様にあわせるため、問題は1テストケース1行の形式で与えられ、各行に1つのテストケースの入力が与えられます。ゴルフ場で良い成績が出たから本番でもそのまま通るとは限りません。特にこの問題は入力の形式の違いによりかなり違うコードが本番で必要な可能性があります。表彰されるためには本来のサイトで投稿する必要があります。投稿サイトは後日ここからリンクをはる予定です。
普段からこのサイトに参加している人へ: 普通に解答を投稿してくれて良いです。ただし状況に応じて問題の更新や解答のリセットなどをするかもしれません。11月16日以降は普通の問題になるはずです。
Given a number N, you'll need to divide it by positive numbers until the number is 1. The goal is to maximize the sum of digits appeared in this process. For example, for N=12 you'll see 12, 6 3, 1 and the sum of digits will be 1+2+6+3+1=13 and this is the maximum number.
For golfers in this site: feel free to submit solutions as usual. Please just understand the problem may be updated and your solutions may be rejudged. No update will be done after Nov. 16.
Personal note: unlike usual, I may examine submitted solutions even before the deadline (I've never done this, trust me :), potentially to introduce interesting techniques in the event. As usual, I can promise I don't abuse the knowledge got in this way.
Options
exec is denied
now post-mortem time, all source codes will be revealed
Sample input:_
12
1
100
Sample output:
13
1
19
Sample input:_
38
30
88
56
11
15
27
35
14
18
100
99
68
16
49
69
54
9
61
8
24
81
40
47
60
72
78
83
85
75
5
90
84
89
21
22
39
48
2
96
12
95
25
4
43
64
1
19
26
67
94
10
44
65
36
55
42
77
41
29
6
32
51
87
7
92
63
98
58
46
33
28
66
20
57
80
97
52
45
86
73
62
23
17
82
53
59
79
13
34
50
91
31
76
74
93
3
37
71
70
Sample output:
22
15
31
34
3
12
22
16
13
22
19
31
30
22
21
21
31
13
8
15
21
31
19
12
21
40
32
12
22
25
6
31
35
18
11
7
17
34
3
49
13
25
13
7
8
37
1
11
13
14
25
7
15
17
31
16
19
22
6
12
10
27
15
27
8
27
22
38
25
16
10
23
22
9
23
30
17
20
22
22
11
13
6
9
16
9
15
17
5
16
18
18
5
35
22
17
4
11
9
23
Ranking
Rank | User | Size | Time | Date | Statistics |
---|
1 | mitchs | 77 | 0.0698 | 2015/11/16 03:29:05 | 0B / 38B / 38B |
2 | kimiyuki | 92 | 0.9040 | 2015/11/13 20:13:10 | 0B / ?B / ?B |
3 | siman | 94 | 0.0508 | 2015/11/13 21:09:28 | 0B / 44B / 47B |
4 | hirokazu1020 | 100 | 0.0622 | 2015/11/13 23:25:47 | 0B / ?B / ?B |
5 | ciel | 111 | 0.0533 | 2015/11/12 00:44:20 | 0B / ?B / ?B |
6 | mitchs (embed) | 121 | 0.0399 | 2015/11/18 06:21:20 | 85B / 14B / 14B |
7 | mitchs_ (embed) | 126 | 0.0261 | 2015/11/11 03:52:48 | 88B / 9B / 21B |
8 | shinh (par) | 160 | 0.0679 | 2015/11/10 23:41:06 | 0B / 91B / 45B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | mitchs | 73 | 0.1684 | 2015/11/16 03:30:59 | 0B / 34B / 38B |
2 | shinh | 75 | 0.1475 | 2015/11/14 03:15:03 | 0B / 39B / 35B |
3 | kimiyuki | 93 | 0.4132 | 2015/11/13 19:41:25 | 0B / ?B / ?B |
4 | siman | 94 | 0.1442 | 2015/11/13 21:09:13 | 0B / 44B / 47B |
5 | ciel | 111 | 0.1380 | 2015/11/12 00:48:47 | 0B / ?B / ?B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | llhuii | 66 | 0.0501 | 2015/11/15 10:33:51 | 1B / 18B / 46B |
2 | tails | 72 | 0.6354 | 2015/11/14 21:51:38 | 0B / 24B / 47B |
3 | kimiyuki | 114 | 0.0238 | 2015/11/13 19:58:28 | 0B / ?B / ?B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | mitchs | 80 | 0.0393 | 2015/11/24 08:38:11 | 0B / 48B / 31B |
2 | mitchs | 78 | 0.0433 | 2015/11/25 13:53:06 | 0B / 46B / 32B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | llhuii | 114 | 0.0213 | 2015/11/14 17:38:38 | 0B / 56B / 58B |
2 | mitchs | 124 | 0.0217 | 2015/11/16 03:34:14 | 0B / 67B / 56B |
3 | ciel | 136 | 0.0246 | 2015/11/24 19:01:28 | 0B / ?B / ?B |
4 | shinh | 138 | 0.0215 | 2015/11/14 11:31:21 | 0B / 69B / 68B |
5 | orisano | 148 | 0.0215 | 2015/11/14 10:45:12 | 0B / ?B / ?B |
6 | cympfh | 179 | 0.0215 | 2015/11/14 01:58:55 | 0B / 91B / 85B |
7 | mitchs (llhuii) | 113 | 0.0213 | 2015/11/25 13:42:22 | 0B / 55B / 58B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | ciel | 172 | 0.0257 | 2015/11/24 19:12:35 | 0B / ?B / ?B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | llhuii | 114 | 0.0212 | 2015/11/24 00:07:54 | 0B / 56B / 58B |
2 | ciel | 136 | 0.0213 | 2015/11/24 19:04:33 | 0B / ?B / ?B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | whio | 91 | 0.1339 | 2015/11/11 07:27:06 | 44B / 21B / 25B |
Rank | User | Size | Time | Date | Statistics |
---|
1 | whio | 19 | 0.7366 | 2015/11/12 01:08:31 | 8B / 8B / 2B |
Language Ranking_
Rank | Lang | User | Size | Score |
1 | gs2 | whio | 19 | 10000 |
2 | J | I., S. | 55 | 3454 |
3 | Perl | llhuii | 66 | 2878 |
4 | Ruby2 | mitchs | 73 | 2602 |
5 | AWK | mitchs (llhuii) | 75 | 2533 |
6 | Ruby | mitchs | 77 | 2467 |
7 | PARI/GP | mitchs | 78 | 2435 |
8 | xgawk | llhuii | 79 | 2405 |
9 | Bash | llhuii | 82 | 2317 |
10 | Zsh | llhuii | 82 | 2317 |
11 | Fish | llhuii | 82 | 2317 |
12 | GolfScript | whio | 91 | 2087 |
13 | Python | mitchs | 91 | 2087 |
14 | Haskell | henkma | 94 | 2021 |
15 | C | mitchs (llhuii) | 113 | 1681 |
16 | ObjC | llhuii | 114 | 1666 |
17 | C++ | ciel | 172 | 1104 |
18 | sed | mitchs (tails (embed)) | 215 | 883 |
return to the top page