結果
| 問題 |
No.589 Counting Even
|
| コンテスト | |
| ユーザー |
ats5515
|
| 提出日時 | 2017-11-03 22:57:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 552 bytes |
| コンパイル時間 | 759 ms |
| コンパイル使用メモリ | 82,132 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-22 16:14:58 |
| 合計ジャッジ時間 | 1,743 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 29 |
コンパイルメッセージ
main.cpp: In function ‘long long int f(long long int)’:
main.cpp:23:1: warning: control reaches end of non-void function [-Wreturn-type]
23 | }
| ^
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
int f(int a) {
if (a == 0) {
return 1;
}
for (int i = 0; i < 62; i++) {
if (a >= ((int)1 << i) && a < ((int)1 << (i + 1))) {
return f(a - ((int)1 << i)) * 2;
}
}
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
//N = (int)1 << 59;
cout << N + 1 - f(N) << endl;
}
ats5515