QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#595363 | #9355. Keeping Rabbits | yeah14 | WA | 49ms | 23492kb | C++17 | 1.6kb | 2024-09-28 13:32:54 | 2024-09-28 13:32:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ull long long
#define PII pair<int ,int>
const int INF = -1145141919810;
const int mod = 1e9 + 7;
const int N = 1e7;
int a[N];
int sum[N];
int fa[N];
int ka[N];
vector<int>pr;
bool vis[N];
void er(int n) {
int cnt = 0;
memset(vis, 0, sizeof(vis));
for (int i = 2; i <= n; i++) {
if (!vis[i])pr.push_back(i);
for (int j = 0; j < pr.size(); j++) {
if (i * pr[j] > n)break;
vis[i * pr[j]] = 1;
if (i * pr[j] == 0)break;
}
}
}
int is_p(int x) {
if (x == 1)return 1;
for (int i = 0; i < pr.size(); i++) {
if (x == pr[i])return 1;
if (x % pr[i] == 0)return 0;
if (pr[i] > x)break;
}
return 1;
}
void solve() {
int n,k;
int sum = 0;
cin >> n>>k;
for (int i = 1; i <= n; i++) {
cin >> a[i];
sum += a[i];
}
for (int i = 1; i <= n; i++) {
double ans = double(a[i])*double(k) / double(sum) + double(a[i]);
printf("%.5lf ", ans);
}
cout << endl;
}
//&&(((sum[n]+k)%mid==0)||(sum[n]/mid!=(sum[n]+k)/mid)||(mid-(sum[n]%mid)>=k))
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t=1;
cin >> t;
//t = 1;
er(9e6);
while (t--)solve();
}
//int n;
//cin >> n;
//for (int i = 1; i <= n; i++) {
// cin >> a[i];
//}
//int maxx = 0, minn = INF;
//int sum = 0;
//for (int i = n; i <= 1; i++) {
// sum += minn;
// if (top == 0) {
// minn = a[i];
// st[top++] = a[i];
// }
// else {
// if (a[i] > top && a[i] > minn)
// }
//}
//cout << maxx - minn << endl;
//7 2 1 4 5 1 3 3
//4 1000 1000 1000 1000
//0
详细
Test #1:
score: 100
Accepted
time: 33ms
memory: 23492kb
input:
3 1 1 2 2 2 1 3 3 2 1 1 1
output:
3.00000 1.50000 4.50000 1.66667 1.66667 1.66667
result:
ok 6 numbers
Test #2:
score: 0
Accepted
time: 43ms
memory: 21668kb
input:
10 10 5 6 9 4 4 4 7 6 2 8 7 10 3 9 4 10 4 2 8 8 6 4 7 10 2 2 5 9 4 9 4 2 7 5 9 10 5 9 1 2 1 10 10 7 9 7 1 10 6 8 3 1 10 5 3 1 6 3 10 10 10 5 9 1 7 10 7 6 6 4 4 10 6 1 7 9 5 1 1 6 3 6 5 10 7 5 6 9 1 9 7 1 1 4 5 10 3 4 10 3 3 10 9 3 6 9 10 10 6 5 5 1 2 4 6 8 1 8 2
output:
6.52632 9.78947 4.35088 4.35088 4.35088 7.61404 6.52632 2.17544 8.70175 7.61404 9.43548 4.19355 10.48387 4.19355 2.09677 8.38710 8.38710 6.29032 4.19355 7.33871 2.07143 5.17857 9.32143 4.14286 9.32143 4.14286 2.07143 7.25000 5.17857 9.32143 9.78947 1.08772 2.17544 1.08772 10.87719 10.87719...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 41ms
memory: 22292kb
input:
10 10 2 18 23 74 43 31 61 59 9 82 39 10 6 82 44 26 99 29 100 24 45 14 8 10 3 10 76 15 14 73 94 48 83 84 20 10 1 35 20 48 6 17 75 57 78 76 39 10 9 13 92 32 23 32 93 13 38 34 64 10 9 45 41 26 90 96 9 20 37 93 14 10 9 81 3 56 89 58 30 21 2 93 28 10 4 69 4 11 77 81 24 19 70 4 85 10 8 5 39 89 36 82 37 12...
output:
18.08200 23.10478 74.33713 43.19590 31.14123 61.27790 59.26879 9.04100 82.37358 39.17768 83.04459 44.56051 26.33121 100.26115 29.36943 101.27389 24.30573 45.57325 14.17834 8.10191 10.05803 76.44101 15.08704 14.08124 73.42360 94.54545 48.27853 83.48162 84.48743 20.11605 35.07761 20.04435 48...
result:
ok 100 numbers
Test #4:
score: -100
Wrong Answer
time: 49ms
memory: 21904kb
input:
10 100 28 54 29 35 99 52 7 52 91 49 4 71 33 22 90 11 73 28 13 43 64 26 47 53 56 32 76 40 80 90 84 18 90 24 96 81 66 82 21 75 58 46 52 45 38 36 82 66 33 4 54 2 57 43 9 64 43 72 10 1 31 80 89 49 100 35 61 44 45 51 51 39 80 80 11 31 95 65 59 81 43 81 2 46 60 90 65 83 55 52 93 80 66 61 29 23 99 2 64 22 ...
output:
54.28822 29.15478 35.18681 99.52840 52.27754 7.03736 52.27754 91.48570 49.26153 4.02135 71.37896 33.17613 22.11742 90.48037 11.05871 73.38963 28.14945 13.06939 43.22951 64.34159 26.13877 47.25086 53.28288 56.29889 32.17080 76.40564 40.21350 80.42699 90.48037 84.44834 18.09607 90.48037 24.12810 9...
result:
wrong answer 460th numbers differ - expected: '89.37359', found: '89.00000', error = '0.00418'