Exemplo n.º 1
0
int main(){
    scanf("%lld%lld%d",&m,&d,&n);
    REP(i,n){
        LL c;
        scanf("%lld",&c);
        taks.PB(c);
    }
Exemplo n.º 2
0
int main()
{
    FastIO(); 
    LL n,i,var,e,l,ans=0;
    VLL v;
    cin >>n;
    for(i=0;i<n;i++)
    {
        cin >>var;
        if(var%2==0)
            ans=ans+var;
        else
            v.PB(var);
    }
    sort(all(v));
    l=v.size();
    if(l%2==0)
        e=0;
    else
        e=1;
    for(i=l-1;i>=e;i--)
        ans=ans+v[i];
    cout <<ans<<"\n";
    return 0;
}
Exemplo n.º 3
0
int main()
{
    FastIO();
    int n,i,var,steps=0;
    VLL b;
    cin >>n;
    for(i=0;i<n;i++)
    {
        cin >>var;
        b.PB(var);
    }
    int cum=0;
    for(i=0;i<n;i++)
    {
        if(cum==b[i])
            continue;
        if(b[i]>cum)
        {
            steps+=(b[i]-cum);
            cum=b[i];
        }
        else 
        {
            if(b[i]<cum)
            {
                steps+=(cum-b[i]);;
                cum=b[i];
            }
        }
    }
    cout <<steps<<"\n";
    return 0;
}
Exemplo n.º 4
0
int main()
{
	LL N, K;
	cin >> N >> K;
	VLL v;
	REP(i,N)
	{
		LL x;
		cin >> x;
		v.PB(x);
	}
Exemplo n.º 5
0
VLL f(LL x)
{
    VLL ret;
    if(x==0)return ret;
    if(x==1)
    {
        ret.PB(1ll); return ret;
    }
    if(x%2==0)
    {
        ret = f(x/2);
        for(auto &c : ret) c*=2;
        return ret;
    }
    LL y = 1;
    while(y<=x)
        y*=3;
    y/=3;
    ret = f(x-y);
    ret.PB(y);
    return ret;
}