結果

問題 No.462 6日知らずのコンピュータ
ユーザー butsurizukibutsurizuki
提出日時 2016-12-20 17:04:10
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 785 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 22,272 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-08 08:43:30
合計ジャッジ時間 2,956 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 0 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 0 ms
5,376 KB
testcase_06 AC 0 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 0 ms
5,376 KB
testcase_09 AC 0 ms
5,376 KB
testcase_10 AC 0 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
5,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 0 ms
5,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 0 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 1 ms
5,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 0 ms
5,376 KB
testcase_34 WA -
testcase_35 AC 0 ms
5,376 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 1 ms
5,376 KB
testcase_39 WA -
testcase_40 AC 1 ms
5,376 KB
testcase_41 AC 1 ms
5,376 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 1 ms
5,376 KB
testcase_45 AC 0 ms
5,376 KB
testcase_46 WA -
testcase_47 AC 1 ms
5,376 KB
testcase_48 WA -
testcase_49 AC 0 ms
5,376 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 0 ms
5,376 KB
testcase_53 AC 1 ms
5,376 KB
testcase_54 AC 0 ms
5,376 KB
testcase_55 AC 0 ms
5,376 KB
testcase_56 AC 0 ms
5,376 KB
testcase_57 AC 1 ms
5,376 KB
testcase_58 AC 1 ms
5,376 KB
testcase_59 AC 1 ms
5,376 KB
testcase_60 AC 0 ms
5,376 KB
testcase_61 AC 0 ms
5,376 KB
testcase_62 AC 0 ms
5,376 KB
testcase_63 AC 1 ms
5,376 KB
testcase_64 AC 0 ms
5,376 KB
testcase_65 AC 1 ms
5,376 KB
testcase_66 AC 0 ms
5,376 KB
testcase_67 AC 0 ms
5,376 KB
testcase_68 AC 1 ms
5,376 KB
testcase_69 AC 1 ms
5,376 KB
testcase_70 AC 0 ms
5,376 KB
testcase_71 AC 1 ms
5,376 KB
testcase_72 AC 1 ms
5,376 KB
testcase_73 AC 0 ms
5,376 KB
testcase_74 WA -
testcase_75 AC 0 ms
5,376 KB
testcase_76 AC 1 ms
5,376 KB
testcase_77 AC 0 ms
5,376 KB
testcase_78 AC 1 ms
5,376 KB
testcase_79 AC 1 ms
5,376 KB
testcase_80 AC 1 ms
5,376 KB
testcase_81 AC 1 ms
5,376 KB
testcase_82 AC 0 ms
5,376 KB
testcase_83 AC 1 ms
5,376 KB
testcase_84 AC 1 ms
5,376 KB
testcase_85 AC 0 ms
5,376 KB
testcase_86 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:18:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |         scanf("%llu%llu",&n,&k);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
main.c:20:31: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |         for(i = 1;i <= k;i++){scanf("%llu",&a[i]);}
      |                               ^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#define X 1000000007

unsigned long long int kaijyo(unsigned long long int k){
	unsigned long long int r=1,i;
	for(i = 1;i <= k;i++){r*=i;r%=X;}
	return r;
}

unsigned long long int bitcount(unsigned long long int k){
	unsigned long long int r=0,i;
	for(i = 1;i <= 64;i++){if(k%2){r++;}k/=2;}
	return r;
}

int main(void) {
	unsigned long long int n,k,a[64],r=1,b[64],c,d=0,i,j;
	scanf("%llu%llu",&n,&k);
	if(k == 0){r = kaijyo(n);printf("%llu\n",r);return 0;}
	for(i = 1;i <= k;i++){scanf("%llu",&a[i]);}
	for(i = 1;i <= k;i++){b[i] = bitcount(a[i]);}
	for(i = 1;i <= n;i++){
		d++;
		c = 0;
		for(j = 1;j <= k;j++){
			if(b[j] == i){c++;}
		}
		if(c == 1){r*=kaijyo(d);d=0;}
		if(c >= 2){printf("0\n");return 0;}
	}
	r*=kaijyo(d);
	printf("%llu\n",r);
	return 0;
}
0