Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
101955 Tom0 序列变换 C++ 通过 100 52 MS 1040 KB 315 2023-09-11 14:49:55

Tests(15/15):


#include <iostream> #include <cmath> using namespace std; typedef long long LL; int n, a[200010], d[200010]; LL ans; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) ans += abs(a[i] - a[i - 1]); cout << ans << endl; return 0; }


测评信息: