听灌多
  • 板块灌水区
  • 楼主eggyparty
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/9/30 16:59
  • 上次更新2024/9/30 20:08:55
查看原帖
听灌多
1201634
eggyparty楼主2024/9/30 16:59

P7071,30分求调,AC了奇数的数据

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    cin>>n;
    if(n%2!=0)
        cout<<-1;
    else
    {
        while(n!=0)
        {
            cout<<floor(log(n)/log(2))<<' ';
            n-=pow(2,floor(log(n)/log(2)));
        }
    }
    return 0;
}
2024/9/30 16:59
加载中...