竞赛
考级
滑稽 . . . . . . . . . . . . . . . . . . . . . . . . 不会真的有人去提交了吧(小声)
一只姜(AAAAAA级遗址)
#include <bits/stdc++.h> using namespace std; long long n,ans,j = 1; int main(){ cin>>n; if(n%2==1){ ans = -1; cout<<ans; return 0; } while(pow(2,j)<10000000){ if(pow(2,j)==n){ ans = n; cout<<ans; return 0; } j++; } while(n>=2){ int tmp = 1; while(pow(2,tmp)<=n){ tmp+=1; } ans = pow(2,(tmp-1)); n-=ans; cout<<ans<<" "; } return 0; }
.Dream.
这不就二进制吗(恼 太水了吧(
180****9992
题目:A36 不是我不想注释,主要是我之前写的代码现在自己看不懂了(悲),有人能读懂吗? 望大佬能讲解下
葬仪_亡蝶舞
为什么第一个例子我输出-1还错了
Xylophone
#include <bits/stdc++.h> using namespace std; int main(){ int a; cin>>a; int y=1; if(a%2!=0){ cout<<"-1"; } else{ while(y<a){ y=2*y; } while(a>1){ while(y>a){ y=y/2; } a=a-y; cout<<y<<" "; } } }
Code Breaker
根本不会
一呜哇
这里面竟然有log2这个函数(求这个数是2的几次方 Dev-C++里没有 注意转int
skirmish
没思路,悲!
刘鑫昊
为啥答案输入256会输出256? 我的代码错哪了? 有人能帮解答一下吗?
二进制也不会啊(恼
不想打代码的餮蒲
提交答案之后,这里将显示提交结果~