結果
| 問題 |
No.47 ポケットを叩くとビスケットが2倍
|
| ユーザー |
lunnear
|
| 提出日時 | 2018-12-11 15:59:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 412 bytes |
| コンパイル時間 | 501 ms |
| コンパイル使用メモリ | 54,636 KB |
| 実行使用メモリ | 10,016 KB |
| 最終ジャッジ日時 | 2024-09-22 01:42:04 |
| 合計ジャッジ時間 | 13,053 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 20 |
ソースコード
#include <iostream>
int main()
{
int n;
std::cin >> n;
if(n == 1)
{
std::cout << "1" << std::endl;
}
int mask = 0x80000000;
while(n & mask)
{
mask >>= 1;
}
if(n != mask)
mask <<= 1;
int ans = (n % 2)? 1:0;
for(;mask != 1; mask >>= 1)
ans++;
std::cout << ans << std::endl;
return 0;
}
lunnear