QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#125173 | #4966. Decimal XOR | Amys4n | AC ✓ | 1ms | 3484kb | C++14 | 1.5kb | 2023-07-16 04:05:04 | 2023-07-16 04:05:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main(){
string a, b, r = "";
cin >> a >> b;
if(b.size()>a.size()){
int j= a.size()-1;
for(int i=b.size()-1; i>=0; i--){
if(j!=-1){
if((((b[i]-'0') >= 7) and ((a[j]-'0') >=7)) or (((b[i]-'0') <= 2) and ((a[j]-'0') <=2))){
r = '0'+r;
} else{
r = '9'+r;
}
j--;
} else {
a = '0' + a;
j=0;
if((((b[i]-'0') >= 7) and ((a[j]-'0') >=7)) or (((b[i]-'0') <= 2) and ((a[j]-'0') <=2))){
r = '0'+r;
} else{
r = '9'+r;
}
}
}
} else{
int j= b.size()-1;
for(int i=a.size()-1; i>=0; i--){
if(j!=-1){
if((((a[i]-'0') >= 7) and ((b[j]-'0') >=7)) or (((a[i]-'0') <= 2) and ((b[j]-'0') <=2))){
r = '0'+r;
} else{
r = '9'+r;
}
j--;
} else {
b = '0' + b;
j=0;
if((((a[i]-'0') >= 7) and ((b[j]-'0') >=7)) or (((a[i]-'0') <= 2) and ((b[j]-'0') <=2))){
r = '0'+r;
} else{
r = '9'+r;
}
}
}
}
cout << r << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3440kb
input:
22776 15954
output:
09099
result:
ok single line: '09099'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3416kb
input:
29 18908
output:
09900
result:
ok single line: '09900'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3420kb
input:
18908 29
output:
09900
result:
ok single line: '09900'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3472kb
input:
0 0
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3376kb
input:
0 999999
output:
999999
result:
ok single line: '999999'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3372kb
input:
999999 0
output:
999999
result:
ok single line: '999999'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
999999 999999
output:
000000
result:
ok single line: '000000'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
102102 111222
output:
000000
result:
ok single line: '000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3420kb
input:
789789 777888
output:
000000
result:
ok single line: '000000'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3464kb
input:
456456 555666
output:
999999
result:
ok single line: '999999'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3472kb
input:
111 102345
output:
000999
result:
ok single line: '000999'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3444kb
input:
200 6789
output:
9999
result:
ok single line: '9999'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3372kb
input:
3456 1023
output:
9999
result:
ok single line: '9999'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3484kb
input:
3456 4567
output:
9999
result:
ok single line: '9999'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
34 89
output:
99
result:
ok single line: '99'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
789789 102345
output:
999999
result:
ok single line: '999999'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3384kb
input:
7897 6789
output:
9000
result:
ok single line: '9000'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3448kb
input:
666666 55555
output:
999999
result:
ok single line: '999999'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3380kb
input:
333 4444
output:
9999
result:
ok single line: '9999'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
22 1
output:
00
result:
ok single line: '00'