提交记录 9019
提交时间 |
评测时间 |
2019-04-03 20:54:40 |
2020-08-01 01:29:25 |
#include<cmath>
#include<cctype>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ns namespace
#define lol long long
using ns std;
struct fastin
{
static const int bs = 10000;
char buf[bs];
int p;
fastin() : p(bs) {}
void flush()
{
fread(buf, 1, bs, stdin);
p = 0;
}
char gc()
{
if (p >= bs)
flush();
return buf[p++];
}
int operator()()
{
int ans = 0;
char ch = gc();
while (ch < '0' || ch > '9')
ch = gc();
while (ch >= '0' && ch <= '9')
{
ans *= 10;
ans += ch - '0';
ch = gc();
}
return ans;
}
} in;
const int M = 233333;
int n;
int a[M];
lol res = 0LL;
int main(int argc,char** argv)
{
n = in();
for(int i = 0;i < n;i++)
{
a[i] = in();
}
res = a[0];
for(int i = 1;i < n;i++)
{
res = a[i] > a[i-1] ? (res + (a[i] - a[i - 1])) : res;
}
printf("%lld\n",res);
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 33.73 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #2 | 41.04 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #3 | 35.02 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #4 | 41.48 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #5 | 35.91 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #6 | 34.89 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #7 | 42.96 us | 52 KB | Accepted | Score: 10 | 显示更多 |
Testcase #8 | 123.67 us | 88 KB | Accepted | Score: 10 | 显示更多 |
Testcase #9 | 507.76 us | 244 KB | Accepted | Score: 10 | 显示更多 |
Testcase #10 | 995.69 us | 436 KB | Accepted | Score: 10 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:29:55 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠