1492A - Three swimmers
题意:
三个人在游泳,分别以每a,b,c分钟游一圈。你在p分钟后到泳池,问最短需要等待多长时间可以看到任意一个人。
题解:
p如果是a或者b或者c的倍数,显然等待时间为0,否则为 a − p a-p%a a−p,b,c同理,取个min就行。
AC代码:
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>