結果

問題 No.473 和と積の和
ユーザー YamyukiYamyuki
提出日時 2016-12-24 15:22:53
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 27 ms / 3,000 ms
コード長 588 bytes
コンパイル時間 864 ms
コンパイル使用メモリ 24,888 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-22 09:15:21
合計ジャッジ時間 2,569 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 0 ms
4,380 KB
testcase_11 AC 0 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 0 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 0 ms
4,376 KB
testcase_18 AC 0 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 0 ms
4,376 KB
testcase_21 AC 0 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 23 ms
4,376 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 4 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 0 ms
4,380 KB
testcase_34 AC 27 ms
4,380 KB
testcase_35 AC 24 ms
4,380 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 23 ms
4,384 KB
testcase_39 AC 21 ms
4,376 KB
testcase_40 AC 23 ms
4,376 KB
testcase_41 AC 0 ms
4,376 KB
testcase_42 AC 1 ms
4,380 KB
testcase_43 AC 1 ms
4,376 KB
testcase_44 AC 2 ms
4,380 KB
testcase_45 AC 1 ms
4,380 KB
testcase_46 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>

long x,num,list[30];
int n,c;
long d[100];

void check(int i,int j){
	long s;
	if(i==c){
		for(j=0;j<n;j++){
			if(d[j]<2) return;
		}
		num++;
		return;
	}
	if(i==0 || list[i]!=list[i-1]){
		j=0;
	}
	for(;j<n;j++){
		if(j==0 || d[j]!=d[j-1]){
			s=d[j];
			d[j]*=list[i];
			check(i+1,j);
			d[j]=s;
		}
	}
}
int main(){
	long i;
	scanf("%d %ld",&n,&x);
	x++;
	for(i=2;i*i<=x;i++){
		while(x%i==0){
			list[c]=i;
			c++;
			x/=i;
		}
	}
	if(x!=1){
		list[c]=x;
		c++;
	}
	if(c>=n){
		for(i=0;i<n;i++){
			d[i]=1;
		}
		check(0,0);
	}
	printf("%ld\n",num);
	return 0;
}
0