Thứ Tư, 27 tháng 4, 2022

FLAG C++

#include <bits/stdc++.h>
using namespace std;
int a1,a2,a3,res;
void giai()
{
    int b=(a1+2*a2+3*a3)/4;
    if(b>=a3)
    {
        b=b-a3;
        res=res+a3;
    }
    else
    {
        res=res+b;
        cout<<res;return;
    }
    if(b>=a2)
    {
        b=b-a2;
        res=res+a2*2;
    }
    else
    {
        res=res+b*2;
        cout<<res;return;
    }
    res=res+b*3;
    cout<<res;
}

int main()
{
    freopen("flag.inp","r",stdin);
    freopen("flag.out","w",stdout);
    cin>>a1>>a2>>a3;
    giai();
}

Không có nhận xét nào:

Đăng nhận xét

Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.