|
|
Общий форумConsider 2 cases: (1) K >= N (2) K < N and fry one side of each steak first. Try cases like: N=7,K=1; N=7,K=2; up to N=7,K=6 and find the pattern. 50 50 10 qwertyuiop[]\asdfghjkl;'zxcvbnm,./ QWERTYUIOP{}|AS aegaegu etoijqt tquqi witowwt zxcjnc oeit potieq iojge nvoq piqper ans=8881647922834867244791415981705771412427494861672253136057167374729235842468240763290 1 1 1 a a ans=0 5 10 3 abcde abc bc c ans=1048576 Edited by author 05.04.2012 20:51 - Edited by author 07.01.2024 21:19 This is invalid test, but anyway 10 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 Answer: 00:13:58 00:13:58 00:13:58 00:13:58 00:13:58 00:27:56 00:27:56 00:27:56 00:27:56 00:27:56 #include "bits/stdc++.h" #define int long long using namespace std; vector<int> eratosfen() { int n = 168841; vector<bool> res(n + 1, false); for (int i = 2; i <= n; ++i) { if (!res[i]) { for (int j = i * i; j < n; j += i) { res[j] = true; } } } vector<int> res2; for (int i = 2; i < res.size(); ++i) { if (!res[i]) { res2.push_back(i); } } return res2; } signed main() { int t; cin >> t; vector<int> a = eratosfen(); while (t--) { int n; cin >> n; if (n == 1) { cout << 2; continue; } cout << a[n - 1] << endl; } } you should count the eratosphen for a larger n in your function Use cumulative count of sorted values. int64_t is not needed (e.g.WA3). It's very strange but it seems that even long double precision doesn't enough for this problem. I had function get_x(polyline, y), that calculates x coordinate of polyline on coordinate y. I implemented it through binary searching and then calculating by formula, but that resulted in WA23. Then I made an optimisation: if polyline has integer point with coordinate y: (x, y), I instantly return x. Edited by author 03.01.2024 20:12 I have done bs on overspeeding with upper bound of 1e12 and EPS of 1e-9. Any idea? Regards So Sui Ming Can you send to me some test????????)) my idea: sum( (-1)^m * a^(n/(p[k1]*p[k2]*..*p[km] ) ) ), where p[i] - is prime number and n % p[i] == 0. also WA(4) why? 1. Q[k]-number for which k- minimal period 2 Q[k]=a^k-sum(Q[i],i<k k%i==0) 3. answer =Q[n]/n AC has. Big numbers rules from Test4. Learhed Python and taken Ac quickly Much more comfortable than java Edited by author 12.02.2018 11:13 There are __int128 and libquadmath with __float128 in GCC/clang. I sure there are problems, where these are sufficient to get AC. What do you think? [svr] solution (double for by K and I) with optimized long arithmetic by 10^9 base (9 digits packed in one int) in C++ can pass only by compiler choosing (got TLE 49 on Visual Studio and only g++ got AC), but solution uses 0.375 time and 63 Mb of memory - i.e. it is almost NOT a solution :)) So I can't imagine how to pass this on Python, which MUST be too slower than C++. Edited by author 30.12.2023 14:03 Domain and name must consist only of LOWERCASE letters and dots The length of each crystal's side is L, not one. 4 строки 274 байта кто короче? Unfortunately, I can't write the Python solution due to the rules, but it exists! Try to find it! input: -2 -2 2 -2 2 2 -2 2 0 2 1 0 -3 output: 7.236067977 input: 1 0 0 1 -1 0 0 -1 0 0 1 2 -1 output: 1.236067977 ... airplane must climb to an altitude of h meters during the first t seconds of the flight ... Can time be less than t when height h is attained ? Edited by author 18.12.2023 11:15 Edited by author 18.12.2023 11:15 1 2 3 1->2:180 180 -180 1->3:180 180 -180 2->3:180 180 -180 overall: 360 0 -360 prefix sum: 360 360 0 hence max from 1 to 3 is 360 do this similarly from 3 to 1 f(x) = (x-7)^2 + (x-4)^2 + (x-5)^2 Find x such that f(x) (cost function) is a minimum. df/dx = 2(x-7) + 2(x-4) + 2(x-5) = 0 3x = 7+4+5 x = (7+4+5)/3 The biggest hurdle is the problem statement itself! |
|
|