intmain(){ scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", a + i); int f = 0, ans = 0; for (int i = 0; i < n; i++, f ^= 1){ set<int> s; for (int j = 1; j * j <= a[i]; j++){ if (a[i] % j) continue; s.insert(j); s.insert(a[i] / j); } for (auto it = s.rbegin(); it != s.rend(); it++){ dp[*it] = (dp[*it] + dp[(*it) - 1]) % mod; } } for (int i = 1; i <= n; i++) ans = (ans + dp[i]) % mod; cout << ans; return0; }
intrand(){ staticint seed = 233; return seed = int(seed * 482711ll % 2147483647); } int n, k;
boolask(int a, int c, int b){ cout << "? " << a << ' ' << b << ' ' << c << endl; char s[10]; cin >> s; return s[0] == 'Y'; }
vector<int> get(int x, int y){ int l = x, r = y; for (int i = 1; i <= n; i++){ if (i == x || i == y) continue; if (ask(l, r, i) == false){ if (ask(i, r, l)) l = i; elseif (ask(l, i, r)) r = i; } } vector<int> v; v.push_back(l); v.push_back(r); for (int i = 1; i <= n; i++){ if (i == l || i == r) continue; if (ask(l, r, i)) v.push_back(i); } return v; }
intmain(){ cin >> n >> k; int dep = 0; for (int i = 1, t = k; i <= n; i++, t *= k){ if (n == (t - 1) / (k - 1)) { dep = i; break; } } vector<int> ans; // cout << dep << endl; while (1){ int x = rand() % n + 1, y = rand() % n + 1; while (x == y) x = rand() % n + 1, y = rand() % n + 1; ans = get(x, y); if (ans.size() == 2 * dep - 1) break; } // cout << "ha" << endl; for (int i = 2; i < ans.size(); i++){ int c = 0; for (int j = 2; j < ans.size(); j++){ if (i == j) continue; if (ask(ans[0], ans[i], ans[j])) c++; } if (c == dep - 2) return cout << "! " << ans[i] << endl, 0; } return0; }