求大佬指点,直接私信就好

P1969 [NOIP2013 提高组] 积木大赛

希望更丰富的展现?使用Markdown
by HYSK_残雪 @ 2019-02-07 22:33:48


@[撒旦与虵](/space/show?uid=138529) ##### 本蒟蒻帮您美化吧 ```cpp #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cstdlib> #include<queue> #include<stack> #include<cmath> #include<sstream> #include<map> using namespace std; long long a[100010],b[100010],c[10010],s=1,maxx,ans; int main() { long long n; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; b[i]=a[i]; } sort(a+1,a+n+1); for(int i=1;i<=n;i++) { if(a[i]==b[s]) { c[s]=i; s++; } } for(int i=1;i<=b[1];i++) { if(a[i]>maxx) maxx=a[i]; } ans=ans+maxx; maxx=0; for(int i=2;i<=s;i++) { for(int j=b[i];j<=b[i+1];j++) { if(a[i]>maxx) maxx=a[i]; } ans=ans+maxx; maxx=0; } cout<<ans<<endl; return 0; } ```
by 星河·莫 @ 2019-02-07 22:49:08


@[HYSK_残雪](/space/show?uid=65671) 我连函数都没学
by BookofDeath @ 2019-02-07 23:20:19


@[撒旦与虵](/space/show?uid=138529) Markdown用完就是你楼上那样。。。美化一下
by HYSK_残雪 @ 2019-02-08 10:58:07


谢了
by BookofDeath @ 2019-02-09 20:54:07


|