提交记录 9753
提交时间 |
评测时间 |
2019-07-12 11:28:33 |
2020-08-01 01:51:17 |
#include <cstdio>
using namespace std;
int n,a[100003],mina,ans;
void clear(int p,int q,int r)
{
for(int i=p;i<=q;i++)
a[i]-=r;
return;
}
int main()
{
int i,j;
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
for(i=1;i<=n;i++)
while(a[i]!=0)
{
mina=2147483646;
for(j=i;j<=n;j++)
if(a[j]!=0)
{
if(mina>a[j])
mina=a[j];
if(a[j+1]==0)
{
clear(i,j,mina);
ans+=mina;
break;
}
}
}
printf("%d",ans);
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 9.27 us | 20 KB | Accepted | Score: 10 | 显示更多 |
Testcase #2 | 11.84 us | 20 KB | Accepted | Score: 10 | 显示更多 |
Testcase #3 | 12.19 us | 20 KB | Accepted | Score: 10 | 显示更多 |
Testcase #4 | 10.72 us | 20 KB | Accepted | Score: 10 | 显示更多 |
Testcase #5 | 11.65 us | 20 KB | Accepted | Score: 10 | 显示更多 |
Testcase #6 | 20.64 us | 20 KB | Accepted | Score: 10 | 显示更多 |
Testcase #7 | 54.69 us | 24 KB | Accepted | Score: 10 | 显示更多 |
Testcase #8 | 446.92 us | 56 KB | Accepted | Score: 10 | 显示更多 |
Testcase #9 | 2.431 ms | 216 KB | Accepted | Score: 10 | 显示更多 |
Testcase #10 | 4.849 ms | 404 KB | Accepted | Score: 10 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:12:16 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠