fork download
  1. #include <set>
  2. #include <map>
  3. #include <list>
  4. #include <cmath>
  5. #include <queue>
  6. #include <stack>
  7. #include <cstdio>
  8. #include <string>
  9. #include <vector>
  10. #include <cstdlib>
  11. #include <cstring>
  12. #include <sstream>
  13. #include <iomanip>
  14. #include <complex>
  15. #include <iostream>
  16. #include <algorithm>
  17.  
  18. #include <ctime>
  19. #include <deque>
  20. #include <bitset>
  21. #include <cctype>
  22. #include <utility>
  23. #include <cassert>
  24. using namespace std;
  25.  
  26. #define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
  27. #define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
  28. #define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
  29. #define EACH(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
  30.  
  31. #define DEBUG(x) { cout << #x << " = " << x << endl; }
  32. #define PR(a,n) { cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl; }
  33. #define PR0(a,n) { cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl; }
  34.  
  35. int main() {
  36. ios :: sync_with_stdio(false); cin.tie(NULL);
  37. cout << (fixed) << setprecision(6);
  38. int test; scanf("%d", &test);
  39. while (test--) {
  40. int x1, x2; scanf("%d.%d", &x1, &x2);
  41. int x = x1 * 100 + x2;
  42. int n, g = -1;
  43. scanf("%d", &n);
  44. FOR(i,1,n) {
  45. int a; scanf("%d", &a);
  46. a *= 100;
  47. while (a % 2 == 0) a /= 2;
  48.  
  49. if (g == -1) g = a;
  50. else g = __gcd(g, a);
  51. }
  52.  
  53. if (x % g == 0) cout << "yes" << endl;
  54. else cout << "no" << endl;
  55. }
  56. return 0;
  57. }
  58.  
  59.  
Success #stdin #stdout 0s 3436KB
stdin
4
10.75
3
2
10
20
0.33
1
1
10000.00
1
2500
1.00
2
3
5
stdout
yes
no
yes
yes