首页 > 其他 > 详细

B. The Number of Products

时间:2019-10-09 22:40:47      阅读:189      评论:0      收藏:0      [点我收藏+]
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const int maxn=1e6+5;
long long n,s1=0,s2=0,a1=0,a2=0,c;
int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)
    {
        int x;
        scanf("%d",&x);
        if(x>0)
        {
            a1++;
        }
        else
        {
            c=a2;
            a2=a1;
            a1=c;
            a2++;
        }
        s1+=a1;
        s2+=a2;
    }
    printf("%lld %lld",s2,s1);

}

 

B. The Number of Products

原文:https://www.cnblogs.com/Shallow-dream/p/11644818.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!