Start: Mar, 06, 2018 09:46:00
计算机161 算法分析与设计 第一次实验课作业(吴银杰、张凯庆)
End: Mar, 10, 2018 10:00:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 5ms
Memory: 1092kB
Author: hwx981122
In contest: 1141

#include<stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	while(n--){
		int a,b,c;
		scanf("%d %d",&a,&b);
		int i;
		i=a/b;
		if(i==2){
			c=b*3;
			printf("%d\n",c);
		}
		else {
			c=b*2;
			if(a%c==0){
				c=b*3;
			}
			printf("%d\n",c);
		}
	}
}