璟雯院

珺璟如晔,雯华若锦

用户工具

站点工具


icpc:problems:704a_three_swimmers
problems
名称Three swimmers
题目编号704A
题目链接codeforces.com/…
来源CodeForces
算法分类数学
难易程度入门

Three swimmers

想法

就简单取个余。注意long long int

可以说是入门题目。

代码实现

#include<cstdio>//uncle-lu
#include<algorithm>
 
int main()
{
	int T;
	scanf("%d", &T);
	for(int t=1; t<=T; ++t)
	{
		long long int p, a, b, c;
		scanf("%lld %lld %lld %lld", &p, &a, &b, &c);
		long long int ans ;
		ans = (a - p%a)%a;
		ans = std::min(ans, (b - p%b)%b);
		ans = std::min(ans, (c - p%c)%c);
		printf("%lld\n", ans);
	}
 
	return 0;
}
/app/www/public/data/pages/icpc/problems/704a_three_swimmers.txt · 最后更改: 2023/10/01 10:39 由 温婕莺