QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#411054 | #6749. Target | wangyu | WA | 1ms | 3720kb | C++14 | 362b | 2024-05-14 20:51:08 | 2024-05-14 20:51:09 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
double a,b,s=0.5,p;
string k;
int main()
{
cin>>a>>b;
while(a!=b&&k.length()<=50)
{
if(a>b)
{
k.push_back('1');
a=a*s;
}
else if(a<b)
{
k.push_back('2');
a=(a-1)*s+1;
}
p=abs(a-b);
if(p<=0.0001)
{
a=b;
}
}
cout<<k;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3640kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3720kb
input:
0.361954 0.578805
output:
212121212121212121212121212121212121212121212121212
result:
wrong answer wa