QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#947987 | #9855. Glass Bead Game | Mobious | AC ✓ | 1ms | 4096kb | C++20 | 3.1kb | 2025-03-22 19:10:22 | 2025-03-22 19:10:24 |
Judging History
answer
#include<bits/stdc++.h>
#define inf 1e18
#define Endl endl
using namespace std;
#define int long long
#define PII pair<int,int>
int dxx[] = {-1, 1, 0, 0}; // 0上 1下
int dyy[] = {0, 0, -1, 1}; // 2左 3右
#define all(a) a.begin()+1, a.begin()+1+n
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){return a*b/gcd(a,b);}
#define ios ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
const int N=2e5+10,mod=998244353;
void solve(){
int n;
cin>>n;
vector<double> a(n+10);
for (int i=1;i<=n;i++){
cin>>a[i];
}
double ans=0;
for (int i=1;i<=n;i++){
double now=0;
for (int j=1;j<=n;j++){
if(i==j)
continue;
now+=a[j]/(a[i]+a[j]);
}
now*=a[i];
ans+=now;
}
cout<<ans<<endl;
}
signed main(){
ios;
int T=1;
cout<<fixed<<setprecision(10);
// cin>>T;
while (T--){
solve();
if(T!=0)
cout<<endl;
}
return 0;
}
//Shift+Alt+F格式化
//⠀⠀⠀⢛⢆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⠀⠀⠂⣠⡀⢀⣀⠀⠠⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⡄⠀⠀⠀
//⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⢀⢤⢤⡘⠀⠀⠀⠀⠔⠋⠘⢆⠀⠙⢦⠀⠑⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠣⠀⠀⠀⠀⠠⢢⠃⠀⠈⠀⠀⠀⠀⠀⠀⠉⢿⣷⡀⠀⠑⡄⠀⠈⢢⠀⠀⢀⡀⠀⢰⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠰⠡⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⣧⠀⠀⠙⠀⠀⠀⣇⠀⠀⠀⠀⠚⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠰⣇⠀⠰⠁⠀⠀⠀⠀⣴⠀⠀⠀⠀⠰⢧⠀⠀⠘⣿⡄⠀⠀⠀⠀⠰⡌⣱⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠤⠀⠀⠉⠀⡁⠀⠀⢠⠀⠀⢎⡆⠀⠀⠀⠐⡤⠵⢖⢲⣿⣇⠀⠀⠰⣦⣦⡈⢫⣃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⢠⡀⠀⠀⢀⡅⣤⠀⣼⠒⠞⣀⡣⣤⣤⣤⣴⢷⣤⣤⠷⣮⢿⠀⠀⠀⠀⠈⠹⡰⠳⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠃⣿⣀⣿⡾⢷⡖⢶⡄⠉⠁⠈⠀⢏⠁⠉⠹⢘⠀⠀⠀⠀⠀⠀⣼⠷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡏⣿⡄⠘⠧⡁⠀⠇⠀⠀⠀⠀⠈⠀⠀⠀⠈⠀⠀⣾⣦⣶⣤⣿⣦⠲⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣠⢁⢹⣇⠀⠀⠀⠀ ~~~ ⠈⣠⠀⠀⣿⣿⣿⣿⡿⣿⣧⡘⢄⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⣾⢸⣿⣦⣀⠂⠀⠀⠀⠀⠀⠀⠀⠀⠔⠊⢹⠀⠀⡹⠛⠟⠁⠠⣇⠛⠿⢦⡑⢄⠀⠀⠄⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⢠⣈⣸⡟⠁⠈⡹⠛⠉⠉⠉⢒⡀⢔⠁⠀⠀⢸⣿⣿⣷⠀⠀⢀⡠⡚⢦⣒⣄⠈⠀⠑⠤⡀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠐⠁⢀⡠⢺⣿⣿⡟⠀⠀⠈⠢⠇⠀⡀⢺⡶⣾⣕⣄⡀⣼⣿⣿⡿⠀⠉⠁⠀⠘⡄⠱⢿⣿⣄⡀⠑⠌⠢⡀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⢀⠴⣋⢠⣾⣿⣿⡁⠀⠀⠀⠀⠀⡸⢁⣿⠇⣿⢻⣷⡍⢾⣿⣿⣿⡄⠀⠀⠀⠀⣸⢧⠈⢻⣿⣿⣦⣀⣀⢠⠀⠀⠀⠀
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 4096kb
input:
2 0.500000 0.500000
output:
0.5000000000
result:
ok found '0.5000000', expected '0.5000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
3 0.500000 0.250000 0.250000
output:
0.9166666667
result:
ok found '0.9166667', expected '0.9166667', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 4096kb
input:
1 1.000000
output:
0.0000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
2 0.538027 0.461973
output:
0.4971078945
result:
ok found '0.4971079', expected '0.4971079', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
3 0.494273 0.190517 0.315210
output:
0.8974534240
result:
ok found '0.8974534', expected '0.8974534', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 4096kb
input:
4 0.197261 0.087416 0.104439 0.610884
output:
0.9824393171
result:
ok found '0.9824393', expected '0.9824393', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
5 0.306241 0.077563 0.409216 0.059593 0.147387
output:
1.4779374690
result:
ok found '1.4779375', expected '1.4779375', error '0.0000000'
Test #8:
score: 0
Accepted
time: 1ms
memory: 4096kb
input:
10 0.036869 0.154271 0.039121 0.093444 0.015092 0.006355 0.260004 0.159292 0.185205 0.050347
output:
3.0239657966
result:
ok found '3.0239658', expected '3.0239658', error '0.0000000'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
15 0.037256 0.092021 0.010070 0.032228 0.117466 0.004701 0.055551 0.001236 0.187293 0.055711 0.207971 0.004382 0.105521 0.088092 0.000501
output:
4.0969732401
result:
ok found '4.0969732', expected '4.0969732', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 4096kb
input:
30 0.039333 0.083460 0.009475 0.008942 0.003020 0.037578 0.045489 0.029958 0.001444 0.044862 0.016973 0.049030 0.034943 0.002248 0.026105 0.020958 0.076519 0.058296 0.035587 0.011935 0.024676 0.006303 0.048558 0.000584 0.014267 0.056606 0.002034 0.087229 0.064801 0.058787
output:
10.2967443290
result:
ok found '10.2967443', expected '10.2967443', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 4096kb
input:
50 0.001021 0.008859 0.000217 0.009289 0.006963 0.018732 0.007280 0.047461 0.012470 0.028122 0.005435 0.012979 0.015871 0.003407 0.020872 0.037227 0.000613 0.043340 0.018878 0.008492 0.021150 0.020627 0.023751 0.012367 0.029199 0.037501 0.085723 0.001351 0.023855 0.015958 0.007456 0.012490 0.034241 ...
output:
17.2197396576
result:
ok found '17.2197397', expected '17.2197397', error '0.0000000'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
100 0.001579 0.004926 0.003032 0.000846 0.000350 0.019884 0.009544 0.015217 0.005413 0.018294 0.000776 0.021315 0.001224 0.040895 0.012111 0.008854 0.019986 0.011898 0.007226 0.015722 0.030665 0.002735 0.016657 0.002375 0.009279 0.027049 0.009811 0.014709 0.004331 0.003090 0.007980 0.001159 0.000640...
output:
33.9904096749
result:
ok found '33.9904097', expected '33.9904097', error '0.0000000'
Extra Test:
score: 0
Extra Test Passed