回答編集履歴
3
加筆
answer
CHANGED
@@ -9,4 +9,9 @@
|
|
9
9
|
}
|
10
10
|
return result;
|
11
11
|
}
|
12
|
+
|
13
|
+
...
|
14
|
+
|
15
|
+
int total = sum(a, a+80); // a[0]~a[79] の総和
|
16
|
+
|
12
17
|
```
|
2
微修正
answer
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
あとxx以上yy未満を渡すってのもあり。標準C++ライブラリの多くはこの流儀です。
|
2
2
|
|
3
3
|
```C
|
4
|
-
int sum(const int* first,
|
4
|
+
int sum(const int* first, const int* last) {
|
5
5
|
int result = 0;
|
6
6
|
while ( first != last ) {
|
7
7
|
result += *first;
|
1
微修正
answer
CHANGED
@@ -7,5 +7,6 @@
|
|
7
7
|
result += *first;
|
8
8
|
++first;
|
9
9
|
}
|
10
|
+
return result;
|
10
11
|
}
|
11
12
|
```
|