保存代码,题解待更新。。。
1 #include <cstdio> 2 #include <string> 3 #include <vector> 4 #include <map> 5 using namespace std; 6 7 #define LL long long 8 9 class TaroCoins{ 10 public: 11 long long getNumber(long long N){ 12 LL pushOne = 0, notPush = 1; 13 while(N){ 14 int dgt = N & 1; N >>= 1; 15 if(!dgt) 16 pushOne += notPush; 17 else 18 notPush += pushOne; 19 } 20 return notPush; 21 } 22 };
时间: 2024-12-16 12:04:24