社区讨论

模拟赛ce求条

学术版参与者 8已保存回复 17

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
17 条
当前快照
1 份
快照标识符
@mhizh5l0
此快照首次捕获于
2025/11/03 18:14
4 个月前
此快照最后确认于
2025/11/03 19:02
4 个月前
查看原帖
  • 代码在本地运行没问题
CPP
#include<bits/stdc++.h>
#define int unsigned long long 
using namespace std;
int ans[]={1, 1, 2, 6, 24, 120, 720, 5040, 40320, 
362880, 3628800, 39916800, 479001600, 6227020800, 
87178291200, 1307674368000, 20922789888000, 
355687428096000, 6402373705728000, 121645100408832000, 
2432902008176640000, 14197454024290336768, 
17196083355034583040, 8128291617894825984, 
10611558092380307456, 7034535277573963776, 16877220553537093632, 12963097176472289280, 12478583540742619136, 11390785281054474240, 9682165104862298112, 
4999213071378415616, 12400865694432886784, 3400198294675128320, 4926277576697053184, 6399018521010896896, 9003737871877668864, 1096907932701818880, 4789013295250014208, 2304077777655037952, 18376134811363311616, 15551764317513711616, 7538058755741581312, 
10541877243825618944, 2673996885588443136, 9649395409222631424, 1150331055211806720, 17172071447535812608, 12602690238498734080, 8789267254022766592, 
15188249005818642432, 18284192274659147776};
int a, b, c, d;
signed main(){
  freopen("intdiv.in","r",stdin);
  freopen("intdiv.out","w",stdout);
  int T;
  cin >> T;
  while(T--){
    cin >> a >> b >> c >> d;
    if((a <= c && d <= b) || (c <= a && b <= d)){
      puts("Yes");
      continue;
    }
    if(b > c){swap(c, b);}
    if(a > d){swap(a, d);}
    int x = 1, y = 1;
    if(b <= 50){x = ans[b] / ans[a - 1];}
    else{for(int i = a; i <= b; ++i){x *= i;}}
    if(d <= 50){y = ans[d] / ans[c - 1];}
    else{for(int i = c; i <= d; ++i){y *= i;}}
    if(x % y == 0 || y % x == 0){puts("Yes");}
    else{puts("No");}
  }
  return 0;
}

回复

17 条回复,欢迎继续交流。

正在加载回复...