Codeforces: A. Vasya and Chocolate

Codeforces: A. Vasya and Chocolate
Problem Link

Solution:

#include<iostream>

using namespace std;

int main()
{
    int t;
    long long s,a,b,c,real,to;
    cin>>t;
    while(t--)
    {
        cin>>s>>a>>b>>c;

        real=s/c;

        to=((real/a)*b)+real;


        cout<<to<<endl;
    }
    return 0;
}


No comments

Theme images by enjoynz. Powered by Blogger.