結果
問題 | No.47 ポケットを叩くとビスケットが2倍 |
ユーザー |
![]() |
提出日時 | 2015-07-26 18:34:07 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 331 bytes |
コンパイル時間 | 1,107 ms |
コンパイル使用メモリ | 157,564 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-08 14:09:40 |
合計ジャッジ時間 | 1,894 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘void input()’: main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; #define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repi(i,0,n) int n; int solve() { return 32-__builtin_clz(n)-(__builtin_popcount(n)==1? 1: 0); } void input() { scanf("%d", &n); } int main() { input(); printf("%d\n", solve()); return 0; }