QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#806901 | #9852. Divisions | rotcar07 | WA | 0ms | 3768kb | C++23 | 416b | 2024-12-09 16:42:37 | 2024-12-09 16:42:38 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
constexpr int N=2e5+5;
int main(){
int x;cin>>x;
if(x==0) cout<<"8\n1 2 3 3 1 4 3 7\n";else
if(x==1) cout<<"6\n1 1 4 5 1 4\n";
else{
vector<int> v;
int c=0;
while(x>1){
c++;
for(int i=1;i<=__lg(x);i++) v.push_back(c);
x-=1<<__lg(x)-1;
}
cout<<v.size()<<'\n';reverse(v.begin(),v.end());
for(int x:v) cout<<x<<' ';cout<<'\n';
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
1
output:
6 1 1 4 5 1 4
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
2
output:
1 1
result:
ok correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
0
output:
8 1 2 3 3 1 4 3 7
result:
ok correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
3
output:
2 2 1
result:
ok correct
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3768kb
input:
4
output:
3 2 1 1
result:
wrong answer wrong answer