QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#125958#4966. Decimal XORAH_Lusho#AC ✓1ms3488kbC++14848b2023-07-18 01:39:272023-07-18 01:39:28

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-18 01:39:28]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3488kb
  • [2023-07-18 01:39:27]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

char digitos(char a, char b) {
    int da = a - '0';
    int db = b - '0';

    if ((da <= 2 && db <= 2) || (da >= 7 && db >= 7))
        return '0';
    else
        return '9';
}


string addCeros(const string& str, int length) {
    if (str.length() >= length)
        return str;

    return string(length - str.length(), '0') + str;
}

string xor10(const string& a, const string& b) {
    int maxLength = max(a.length(), b.length());

    string ca = addCeros(a, maxLength);
    string cb = addCeros(b, maxLength);

    string result;
    for (int i = 0; i < maxLength; ++i) {
        result += digitos(ca[i], cb[i]);
    }

    return result;
}

int main() {
    string a, b;
    cin >> a >> b;

    string res = xor10(a, b);
    cout << res << endl;

}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3420kb

input:

22776
15954

output:

09099

result:

ok single line: '09099'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3380kb

input:

29
18908

output:

09900

result:

ok single line: '09900'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3376kb

input:

18908
29

output:

09900

result:

ok single line: '09900'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3452kb

input:

0
0

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3472kb

input:

0
999999

output:

999999

result:

ok single line: '999999'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

999999
0

output:

999999

result:

ok single line: '999999'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

999999
999999

output:

000000

result:

ok single line: '000000'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3356kb

input:

102102
111222

output:

000000

result:

ok single line: '000000'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3420kb

input:

789789
777888

output:

000000

result:

ok single line: '000000'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3404kb

input:

456456
555666

output:

999999

result:

ok single line: '999999'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3480kb

input:

111
102345

output:

000999

result:

ok single line: '000999'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3416kb

input:

200
6789

output:

9999

result:

ok single line: '9999'

Test #13:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

3456
1023

output:

9999

result:

ok single line: '9999'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3488kb

input:

3456
4567

output:

9999

result:

ok single line: '9999'

Test #15:

score: 0
Accepted
time: 1ms
memory: 3444kb

input:

34
89

output:

99

result:

ok single line: '99'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3416kb

input:

789789
102345

output:

999999

result:

ok single line: '999999'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3420kb

input:

7897
6789

output:

9000

result:

ok single line: '9000'

Test #18:

score: 0
Accepted
time: 1ms
memory: 3416kb

input:

666666
55555

output:

999999

result:

ok single line: '999999'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3420kb

input:

333
4444

output:

9999

result:

ok single line: '9999'

Test #20:

score: 0
Accepted
time: 1ms
memory: 3424kb

input:

22
1

output:

00

result:

ok single line: '00'