A:签到。

#include<iostream> 
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
    int x=0,f=1;char c=getchar();
    while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
    while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
    return x*f;
}
#define ll long long
int t,a,b,c,d;
int main()
{
    t=read();
    while (t--)
    {
        a=read(),b=read(),c=read(),d=read();
        cout<<a/d+1ll*a/d/b*c<<endl;
    }
    return 0;
}
View Code

相关文章: