QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#227337#3423. Base-2 PalindromesBashca#AC ✓15ms4216kbC++23661b2023-10-27 12:32:482023-10-27 12:32:49

Judging History

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

  • [2023-10-27 12:32:49]
  • 评测
  • 测评结果:AC
  • 用时:15ms
  • 内存:4216kb
  • [2023-10-27 12:32:48]
  • 提交

answer

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

vector<long long> t;
void bt(int pos, string s) {
    if (pos == 15) {
        while (s.size() > 1 && s[0] == '0') {
            s = s.substr(1, s.size()-2);
        }
        long long num = 0;
        for (auto c : s) {
            num = num * 2 + c - '0';
        }
        t.push_back(num);
        return;
    }
    bt(pos+1, "1" + s + "1");
    bt(pos+1, "0" + s + "0");
}

int main() {
    bt(0, "0");
    bt(0, "1");
    bt(0, "");
    sort(t.begin(), t.end());
    t.erase(unique(t.begin(), t.end()), t.end());
    int m;
    cin>>m;
    cout << t[m] << '\n';
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 14ms
memory: 4088kb

input:

47345

output:

507291535

result:

ok single line: '507291535'

Test #2:

score: 0
Accepted
time: 14ms
memory: 3912kb

input:

1

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 14ms
memory: 4104kb

input:

2

output:

3

result:

ok single line: '3'

Test #4:

score: 0
Accepted
time: 14ms
memory: 4172kb

input:

3

output:

5

result:

ok single line: '5'

Test #5:

score: 0
Accepted
time: 14ms
memory: 4124kb

input:

4

output:

7

result:

ok single line: '7'

Test #6:

score: 0
Accepted
time: 14ms
memory: 3948kb

input:

5

output:

9

result:

ok single line: '9'

Test #7:

score: 0
Accepted
time: 7ms
memory: 4140kb

input:

6

output:

15

result:

ok single line: '15'

Test #8:

score: 0
Accepted
time: 15ms
memory: 4216kb

input:

7

output:

17

result:

ok single line: '17'

Test #9:

score: 0
Accepted
time: 14ms
memory: 3956kb

input:

8

output:

21

result:

ok single line: '21'

Test #10:

score: 0
Accepted
time: 14ms
memory: 3964kb

input:

9

output:

27

result:

ok single line: '27'

Test #11:

score: 0
Accepted
time: 15ms
memory: 4100kb

input:

10

output:

31

result:

ok single line: '31'

Test #12:

score: 0
Accepted
time: 9ms
memory: 4108kb

input:

11

output:

33

result:

ok single line: '33'

Test #13:

score: 0
Accepted
time: 14ms
memory: 4120kb

input:

12

output:

45

result:

ok single line: '45'

Test #14:

score: 0
Accepted
time: 14ms
memory: 4216kb

input:

13

output:

51

result:

ok single line: '51'

Test #15:

score: 0
Accepted
time: 14ms
memory: 4108kb

input:

14

output:

63

result:

ok single line: '63'

Test #16:

score: 0
Accepted
time: 11ms
memory: 4104kb

input:

15

output:

65

result:

ok single line: '65'

Test #17:

score: 0
Accepted
time: 14ms
memory: 4160kb

input:

16

output:

73

result:

ok single line: '73'

Test #18:

score: 0
Accepted
time: 7ms
memory: 3908kb

input:

17

output:

85

result:

ok single line: '85'

Test #19:

score: 0
Accepted
time: 14ms
memory: 4144kb

input:

18

output:

93

result:

ok single line: '93'

Test #20:

score: 0
Accepted
time: 11ms
memory: 3944kb

input:

19

output:

99

result:

ok single line: '99'

Test #21:

score: 0
Accepted
time: 14ms
memory: 4092kb

input:

20

output:

107

result:

ok single line: '107'

Test #22:

score: 0
Accepted
time: 15ms
memory: 4160kb

input:

50000

output:

564708705

result:

ok single line: '564708705'

Test #23:

score: 0
Accepted
time: 10ms
memory: 4216kb

input:

1231

output:

368685

result:

ok single line: '368685'

Test #24:

score: 0
Accepted
time: 14ms
memory: 4116kb

input:

12319

output:

33816705

result:

ok single line: '33816705'