B. The Number of Products

Posted shallow-dream

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了B. The Number of Products相关的知识,希望对你有一定的参考价值。

#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的主要内容,如果未能解决你的问题,请参考以下文章

Codeforces Round #585 (Div. 2) B. The Number of Products

CF 1215 B The Number of Products(思维题)

Codeforces Round #585 (Div. 2) B.The Number of Products(动态规划)

15. Life Cycle of the Products 产品的生命周期

Round #427 B. The number on the board(Div.2)

Codeforces Round #342 (Div. 2) B. War of the Corporations(贪心)