思路

求最小公倍数,怕他越界所以用了int128。

代码

#include<bits/stdc++.h>
#define int __int128
using namespace std;

int t,x,y;

inline void read(int &data){
    int x=0;char ch=getchar();
    while(ch<'0'||ch>'9') ch=getchar();
    while(ch>='0'&&ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    data=x;
}

int gcd(int a,int b){
    if(!b) return a;
    return gcd(b,a%b);
}

inline void write(int x){
    if(x>9){
        write(x/10);
    }
    putchar(x%10+'0');
}

signed main(){
    read(t);
    for(int i=1;i<=t;i++){
        read(x);read(y);
        int gd=gcd(x,y);
        printf("Case %d: ",i);
        write(x/gd*y);
        putchar('\n');
    }
    return 0;
}