选拔赛c题武器大师的宝贝

#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
typedef long long ll;
ll getshu(ll a,ll c)
{
    while(1)
    {if(c%a==0)
        {return a;break;}
        ll tep=c;
        c=a;
        a=tep%a;}
}
int main()
{
    int t;
cin>>t;
while(t--)
{
    ll fl,fr,sl,sr;
    cin>>fl>>fr>>sl>>sr;
    ll ans=0;
    if(fr<sl||sr<fl)cout<<"0/1"<<endl;
   else
   {
        if(fl<=sl&&fr>=sl)
   {
       if(fr<=sr)ans+=fr-sl+1;
       else ans+=sr-sl+1;
   }
   if(sl<fl&&sr>=fl)
   {
       if(sr<=fr)ans+=sr-fl+1;
       else ans+=fr-fl+1;
   }
        ll f1=fr-fl+1,f2=sr-sl+1;
        ll fz=f1*f2;
        ll chu=getshu(ans,fz);
        cout<<ans/chu<<"/"<<fz/chu<<endl;
   }
}
}
上一篇:不止鸿蒙OS,华为的备用操作系统还有“极光”?


下一篇:云原生数据库设计新思路