P2320 [HNOI2006] Guiguzi purse - decimal (all right do not look this up)

N is the number can be represented in all 1 to n / 2; and

I started to write a binary number in 1 out, but WA two points;

 Minute jig?

A lot of people say that the data in question, I do not know, I do not want to know;

%:include<cstdio>
%:include<cstring>
%:include<algorithm>
using namespace std;
const int maxn=1e5+10;
int m;
int sum;
int a<:maxn:>;
int main()
<%
    scanf("%d",&m);
    while(m>0)
    <%
        m%2==0?a<:++sum:>=m/2:a<:++sum:>=m/2+1;
        m /= 2;
    %>
    sort(a+1,a+sum+1);
    printf("%d\n",sum);
    for(int i=1;i<=sum;i++)
    <%
        printf("%d ",a[i]);
    %>
    return 0;
%>
 

 

Guess you like

Origin www.cnblogs.com/WHFF521/p/11593902.html