QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#246675 | #5152. Circular Caramel Cookie | thanhchauns2# | WA | 1ms | 3788kb | C++20 | 2.3kb | 2023-11-11 00:06:14 | 2023-11-11 00:06:15 |
Judging History
answer
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
//@etohari
using namespace std;
using namespace __gnu_pbds;
#define my_wife "She belongs to another guy"
#define bit(mask,i) ((mask >> i)&1)
#define cntbit(mask) __builtin_popcountll(mask)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define uniquev(v) sort(all(v)), (v).resize(unique(all(v)) - (v).begin())
#define sz(s) (int32_t)s.size()
#define __lcm(a,b) ((int64_t)a / __gcd(a, b) * b)
#define rand(l, r) uniform_int_distribution < int64_t > (l, r)(rng)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree < int32_t, null_type, less < int32_t >, rb_tree_tag,tree_order_statistics_node_update >
void etohari();
void init(){};
signed main() {
cin.tie(NULL)->sync_with_stdio(false);
// https://www.facebook.com/hai290605
constexpr bool MULTITEST = 0;
// https://codeforces.com/profile/I_Will_Marry_Ngoc
init();
int32_t test = 1;
if (MULTITEST) cin >> test;
for (int32_t i_test = 1; i_test <= test; i_test ++){
etohari();
cout << "\n";
}
return (0 ^ 0);
}
template < class T > bool minimum(T& a, T& b) { return b < a ? a = b, 1 : 0; }
template < class T > bool maximum(T& a, T& b) { return a < b ? a = b, 1 : 0; }
constexpr int32_t MAXN = 1e3 + 10;
constexpr int32_t MAXM = 1e6 + 10;
constexpr int32_t MOD = 1e9 + 7;
constexpr int32_t INF = 0x3f3f3f3f;
constexpr long double PI = 3.14159265358979323846;
constexpr int16_t DR[] = { };
constexpr int16_t DC[] = { };
#define int int64_t
void etohari(){
int s;
cin >> s;
long double ans = 1e30;
for (int r = 1; r * (r - 1) <= s; r ++){
for (int i = -10; i < 10; i ++){
int c = s / r + i;
if (c <= 0)continue;
int p = r * c + (r == c ? 0 : 2 * (max(r, c) - abs(r - c)));
if (p >= s){
ans = min(ans, (long double)sqrt(r * r + c * c) / 2.0);
}
}
}
cout << fixed << setprecision(20) << ans;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3668kb
input:
11
output:
2.23606797749978980505
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3788kb
input:
59
output:
5.00000000000000000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3660kb
input:
1
output:
0.70710678118654757274
result:
wrong answer 1st numbers differ - expected: '1.4142136', found: '0.7071068', error = '0.5000000'