結果
| 問題 | No.589 Counting Even |
| ユーザー |
C
|
| 提出日時 | 2026-11-11 16:04:44 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 1,337 bytes |
| 記録 | |
| コンパイル時間 | 7,617 ms |
| コンパイル使用メモリ | 391,656 KB |
| 実行使用メモリ | 9,924 KB |
| 最終ジャッジ日時 | 2026-11-11 16:04:55 |
| 合計ジャッジ時間 | 8,965 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 WA * 5 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
#include <boost/polygon/point_data.hpp>
#include <boost/polygon/voronoi.hpp>
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(x) begin(x),end(x)
#define sz(x) (int)(x).size()
using namespace std;
using namespace atcoder;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vi>;
using pll=pair<ll,ll>;
using pi=pair<int,int>;
// using mint=modint998244353;
using mint=modint1000000007;
// using mint2=static_modint<2>;
// using BoostPoint=boost::polygon::point_data<int>;
// using Voronoi=boost::polygon::voronoi_diagram<double>;
// using mint=LazyMontgomeryModInt<998244353>;
using vm=vector<mint>;
using vvm=vector<vm>;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
/**
* wikiにそのまま乗っています
* Parity: To count odd terms in row n, convert n to binary.
* Let x be the number of 1s in the binary representation.
* Then the number of odd terms will be 2^x.
* These numbers are the values in Gould's sequence.[24]
*
* https://en.wikipedia.org/wiki/Pascal's_triangle
*
* 自力ACできませんでしたが
*/
ull N;
cin>>N;
cout<<N+1-(1<<popcount(N))<<'\n';
}
C