結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー TLwiegehtt
提出日時 2015-07-15 11:23:25
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 146 ms / 5,000 ms
コード長 438 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 02:20:42
合計ジャッジ時間 2,234 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:14:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                 scanf("%d", &a);
      |                 ^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>


char dp[3][32780];

int main(void){
	int i,j,n;
	int cnt=0;
	scanf("%d", &n);
	
	dp[0][0] = 1;
	for(i=1;i<=n;i++){
		int a;
		scanf("%d", &a);
		for(j=0;j<32780;j++){
			int front = (i+1)%2;
			int now = i%2;
			
			if(dp[front][j] == 1){
				int xor = a^j;
				dp[now][xor] = 1;
				dp[now][j] = 1;
			}
			
		}
	}
	
	for(i=0;i<32780;i++){
		if(dp[n%2][i] == 1){
			cnt++;
		}
	}
	
	printf("%d\n", cnt);
	return 0;
}
0