結果
| 問題 | No.638 Sum of "not power of 2" | 
| コンテスト | |
| ユーザー |  ldsyb | 
| 提出日時 | 2018-02-11 00:59:57 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                CE
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 410 bytes | 
| コンパイル時間 | 1,749 ms | 
| コンパイル使用メモリ | 158,132 KB | 
| 最終ジャッジ日時 | 2024-11-14 20:20:45 | 
| 合計ジャッジ時間 | 2,176 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
            
            
            
            
            ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:7:24: error: the type 'const main()::<lambda(int64_t)>' of 'constexpr' variable 'bitcount' is not literal
    7 |         constexpr auto bitcount = [](int64_t x) {
      |                        ^~~~~~~~
main.cpp:7:36: note: 'main()::<lambda(int64_t)>' is not literal because:
    7 |         constexpr auto bitcount = [](int64_t x) {
      |                                    ^
cc1plus: note:   'main()::<lambda(int64_t)>' is a closure type, which is only literal in C++17 and later
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
	int64_t n;
	cin >> n;
	constexpr auto bitcount = [](int64_t x) {
		int r = 0;
		for (; x; x >>= 1) {
			if (x & 1) {
				r++;
			}
		}
		return r;
	};
	for (int64_t a = 3; a < 500; a++) {
		int64_t b = n - a;
		if (0 < b && 1 < bitcount(a) && 1 < bitcount(b)) {
			cout << a << ' ' << b << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}
            
            
            
        