#include <iostream>
using namespace std;
int main() {
int n,d[100000];
int ans = 0;
cin >> n;
for(int i = 0;i < n;i++) {
cin >> d[i];
}
if(n==1) {
cout << 0;
return 0;
}
for(int i = 0;i < n-1;i++) {
ans += d[i]+d[i+1];
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Correct |
8 ms |
996 KB |
Output is correct |
3 |
Incorrect |
24 ms |
1832 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
604 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Correct |
8 ms |
996 KB |
Output is correct |
3 |
Incorrect |
24 ms |
1832 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |