| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 43381 | 范墨涵 | 【J】T2 | C++ | Wrong Answer | 80 | 0 MS | 256 KB | 687 | 2026-10-29 13:47:48 |
#include<bits/stdc++.h> using namespace std; const int N = 1e3+10; int t; int n,A; int ans; int a[N]; void dfs(int st,int x){ for (int i=1;i<=n;i++){ if (a[i]>x) continue; if (x%a[i]==0){ ans=st; return ; } dfs(st+1,x%a[i]); } return ; } int main(){ //freopen("a.in","r",stdin); //freopen("a.out","w",stdout); cin >> t; while (t--){ cin >> n >> A; for (int i=1;i<=n;i++) cin >> a[i]; sort (a+1,a+1+n,greater<int>()); ans=30; dfs(1,A); if (ans==30) cout << -1 << endl; else cout << ans << endl; } return 0; }