| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 43371 | hanyihong | 【J】T2 | C++ | Wrong Answer | 40 | 0 MS | 256 KB | 469 | 2026-10-29 13:31:52 |
#include<bits/stdc++.h> using namespace std; const int N=25; int n,m,a[N],ans=INT_MAX,T; void dfs(int x,int stp){ if(stp>=ans)return; for(int i=1;i<=n;i++){ if(x%a[i]==0)ans=stp; else if(x>a[i])dfs(x%a[i],stp+1); } } int main(){ cin>>T; while(T--){ cin>>n>>m; for(int i=1;i<=n;i++)cin>>a[i]; dfs(m,1); if(ans==INT_MAX)cout<<-1<<'\n'; cout<<ans<<'\n'; } return 0; }