結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー | albicilla |
提出日時 | 2015-07-16 08:47:59 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,420 bytes |
コンパイル時間 | 1,086 ms |
コンパイル使用メモリ | 142,792 KB |
実行使用メモリ | 4,504 KB |
最終ジャッジ日時 | 2023-09-22 16:40:13 |
合計ジャッジ時間 | 3,075 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | WA | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | WA | - |
ソースコード
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef long double ld; #define fr first #define sc second #define mp make_pair #define pb push_back #define rep(i,x) for(int i=0;i<x;i++) #define rep1(i,x) for(int i=1;i<=x;i++) #define rrep(i,x) for(int i=x-1;i>=0;i--) #define rrep1(i,x) for(int i=x;i>0;i--) #define sor(v) sort(v.begin(),v.end()) #define rev(s) reverse(s.begin(),s.end()) #define lb(vec,a) lower_bound(vec.begin(),vec.end()) #define ub(vec,a) upper_bound(vec.begin(),vec.end()) #define uniq(vec) vec.erace(unique(vec.begin(),vec.end(),vec.end)) #define mp1(a,b,c) P1(a,P(b,c)) #define all(x) (x).begin(),(x).end() #define MAX_N 10010 #define NIL -1 //yukicoder No.183 たのしい排他的論理和(Easy) /*方針 int型でdata[20]とる。20>14 ビットが立っている個数の和をだし、その2乗を出力 ビット排他的論理和は x^y と書く。 今回の方針ではたったビットを残したいので ビット論理和 x|y を使う 立っているビット数は"明日使えないすごいビット演算" より。 */ int a[20]; int main(){ int n; scanf("%d", &n); for (int i = 1; i <= n; i++){ scanf("%d", &a[i]); a[i]=a[i] | a[i - 1]; } int data = a[n]; // cout <<data<<endl; int count = 0; for (; data; data &= data - 1){ ++count; } int ans=1; rep(i,count-1) ans*=2; printf("%d",ans ); return 0; }