답안 #19757

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
19757 2016-02-25T05:18:30 Z ainta 동전 (kriii4_E) C++
5 / 100
9 ms 1212 KB
#include<stdio.h>
int D[32768];
void Do(int x, int pv, int s){
    if(pv==15|| !(x&(1<<pv))){
        if(!D[x^s])D[x]=1;
        return;
    }
    Do(x,pv+1,s);
    Do(x,pv+1,s|(1<<pv));
}
int main(){
    int i, j, k, res, n;
    D[0] = 0;
    for(i=1;i<32768;i++){
        for(j=0;j<15;j++){
            if((1<<j)&i)Do(i,j+1,(1<<j));
        }
    }
   /* for(i=1;i<=15;i++){
        res = 0;
        for(j=0;j<(1<<i);j++)if(D[j]==0)res++;
        printf("%d\n",res);
    }*/
    scanf("%d",&n);
    if(n<=15){
        res = 0;
        for(i=0;i<(1<<n);i++)if(D[i]==0)res++;
        printf("%d\n",res);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1212 KB Output is correct
2 Correct 9 ms 1212 KB Output is correct
3 Correct 9 ms 1212 KB Output is correct
4 Correct 9 ms 1212 KB Output is correct
5 Correct 9 ms 1212 KB Output is correct
6 Correct 9 ms 1212 KB Output is correct
7 Correct 9 ms 1212 KB Output is correct
8 Correct 9 ms 1212 KB Output is correct
9 Correct 9 ms 1212 KB Output is correct
10 Correct 9 ms 1212 KB Output is correct
11 Correct 9 ms 1212 KB Output is correct
12 Correct 9 ms 1212 KB Output is correct
13 Correct 9 ms 1212 KB Output is correct
14 Correct 9 ms 1212 KB Output is correct
15 Correct 9 ms 1212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 1208 KB Output isn't correct
2 Halted 0 ms 0 KB -