首页 > 其他 > 详细

codeforces

时间:2021-02-25 15:12:18      阅读:25      评论:0      收藏:0      [点我收藏+]

```

#include<bits/stdc++.h>
#define int long long
using namespace std;
int T;
signed main()
{
cin>>T;
while(T--)
{
int p,a,c,ans=5e18;
cin>>p;
for(int i=1;i<=3;i++)
{
cin>>a;
if(p<=a)
ans=min(ans,a-p);
else
{
c=p/a;
if(p%a!=0)
c++;
ans=min(ans,1ll*a*c-p);
}
}
cout<<ans<<endl;
}
return 0;
}

```

codeforces

原文:https://www.cnblogs.com/wqy2003/p/14446777.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!