結果
| 問題 |
No.47 ポケットを叩くとビスケットが2倍
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-07 21:51:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,238 bytes |
| コンパイル時間 | 668 ms |
| コンパイル使用メモリ | 80,200 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 18:52:53 |
| 合計ジャッジ時間 | 1,394 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 7 |
ソースコード
#include <iostream>
#include <vector>
#include <utility>
#include <set>
#include <list>
#include <cassert>
#include <queue>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long int;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define YES(n) std::cout << ((n) ? "YES" : "NO" ) << "\n";
#define Yes(n) std::cout << ((n) ? "Yes" : "No" ) << "\n";
#define ALL_INCLUDED_ENVIRONMENT
template <class T, class Alloc, template <class, class> class C> std::ostream& operator<<(std::ostream& o, const C<T, Alloc>& v) {
o << "{";
bool init = 1;
for (auto e : v) {
if (init) { init = 0; }
else { o << ", "; }
o << e;
}
o << "}";
return o;
}
int int_width (ll x) {
int ans = 0;
while(x > 0) {
x = x >> 1;
ans++;
}
return ans;
}
int popcnt(uint64_t n)
{
return __builtin_popcountll(n);
}
int tzcnt(uint64_t n)
{
return n == 0 ? 64 : __builtin_ctzll(n);
}
int lzcnt(uint64_t n)
{
return n == 0 ? 64 : __builtin_clzll(n);
}
int main() {
// cin.tie(0);
// ios::sync_with_stdio(false);
ll n;
cin >> n;
ll k = 1 & n ? n - 1 : n;
ll ans = int_width(k);
if (popcnt(k) == 1 || k == 0) ans--;
if (1 & n) ans++;
cout << ans << "\n";
return 0;
}