QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#820280#9852. Divisionstselmegkh#WA 0ms3704kbC++14966b2024-12-18 20:40:342024-12-18 20:40:36

Judging History

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

  • [2024-12-18 20:40:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3704kb
  • [2024-12-18 20:40:34]
  • 提交

answer

#include<iostream>
using namespace std;


void solve() {
    int k;
    cin >> k;
    if (k == 0) {
        cout << "6\n" << "3 1 4 2 5 4\n";
        return;
    }
    if (k == 1) {
        cout << "6\n" << "1 1 4 5 1 4\n";
        return;
    }

    int tmp = k;
    int cnt = 0;
    while (tmp != 1) {
        if (tmp % 2 == 0) {
            cnt++;
            tmp /= 2;
        }
        else break;
    }
    if (tmp == 1) {
        cout << cnt << '\n';
        for (int i = 0; i < cnt; i++) {
            cout << 1 << " \n"[i == cnt - 1];
        }
        return;
    }
    if (k <= 365) {
        cout << k << '\n';
        cout << 1 << ' ';
        for (int i = k; i >= 2; i--) {
            cout << i << " \n"[i == 2];
        }
        return;
    }
    cout << "-1\n";
}

int main() {
    ios::sync_with_stdio(0);cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3704kb

input:

1

output:

6
1 1 4 5 1 4

result:

ok correct

Test #2:

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

input:

2

output:

1
1

result:

ok correct

Test #3:

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

input:

0

output:

6
3 1 4 2 5 4

result:

ok correct

Test #4:

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

input:

3

output:

3
1 3 2

result:

ok correct

Test #5:

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

input:

4

output:

2
1 1

result:

ok correct

Test #6:

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

input:

5

output:

5
1 5 4 3 2

result:

ok correct

Test #7:

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

input:

6

output:

6
1 6 5 4 3 2

result:

ok correct

Test #8:

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

input:

7

output:

7
1 7 6 5 4 3 2

result:

ok correct

Test #9:

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

input:

8

output:

3
1 1 1

result:

ok correct

Test #10:

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

input:

9

output:

9
1 9 8 7 6 5 4 3 2

result:

ok correct

Test #11:

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

input:

10

output:

10
1 10 9 8 7 6 5 4 3 2

result:

ok correct

Test #12:

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

input:

11

output:

11
1 11 10 9 8 7 6 5 4 3 2

result:

ok correct

Test #13:

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

input:

12

output:

12
1 12 11 10 9 8 7 6 5 4 3 2

result:

ok correct

Test #14:

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

input:

13

output:

13
1 13 12 11 10 9 8 7 6 5 4 3 2

result:

ok correct

Test #15:

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

input:

14

output:

14
1 14 13 12 11 10 9 8 7 6 5 4 3 2

result:

ok correct

Test #16:

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

input:

15

output:

15
1 15 14 13 12 11 10 9 8 7 6 5 4 3 2

result:

ok correct

Test #17:

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

input:

16

output:

4
1 1 1 1

result:

ok correct

Test #18:

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

input:

24

output:

24
1 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2

result:

ok correct

Test #19:

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

input:

31

output:

31
1 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2

result:

ok correct

Test #20:

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

input:

32

output:

5
1 1 1 1 1

result:

ok correct

Test #21:

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

input:

63

output:

63
1 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2

result:

ok correct

Test #22:

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

input:

64

output:

6
1 1 1 1 1 1

result:

ok correct

Test #23:

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

input:

127

output:

127
1 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39...

result:

ok correct

Test #24:

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

input:

128

output:

7
1 1 1 1 1 1 1

result:

ok correct

Test #25:

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

input:

255

output:

255
1 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 18...

result:

ok correct

Test #26:

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

input:

256

output:

8
1 1 1 1 1 1 1 1

result:

ok correct

Test #27:

score: -100
Wrong Answer
time: 0ms
memory: 3552kb

input:

511

output:

-1

result:

wrong answer jury has answer but participant not