ÇÁ·Î±×·¡¹Ö

 3198, 1/160 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   goldbear564
   c¾ð¾î·Î 2^128±¸Çϱâ

http://www.hackerschool.org/HS_Boards/zboard.php?AllArticle=true&no=3413 [º¹»ç]


¸»±×´ë·Î 2^128 ±¸Çϱ⠰úÁ¦¸¦ Çб³¿¡¼­ ¹Þ¾Ò´Âµ¥
¹è¿­·Î ±¸Ç϶ó³×¿ä.

ÀÏ´Ü ±×³É »ý°¢³ª´Â´ë·Î ½áº¸¾Ò´Âµ¥ unsigned long long int ·Î ÇØºÃ´Âµ¥ ¾ÈµÇ´õ±º¿ä.

#include<stdio.h>

int main(void)
{
        unsigned long long int arr[128];
        int i;

        arr[0]=2;

        for(i=1;i<128;i++)
        {
                arr[i]=arr[i-1]*2;
        }

        printf("%llu\n",arr[127]);
        return 0;
}

ÀÌ·¸°Ô ÇØ¤²¤È¤µ´Âµ¥ ¸·»ó ½ÇÇà½ÃÄѺ¸¸é 0ÀÌ ³ª¿À´õ±º¿ä.

±×·¡¼­ ±¸±Û¸µÀ» ÇØº¸´Ï ¿¬°á¸®½ºÆ®·Î ±¸Çغ¸¶ó°í Çϴµ¥
¿¬°á¸®½ºÆ®°¡ ÀÌÇØ°¡ °¡Áú ¾Ê³×¿ä.

¿¬°á¸®½ºÆ®¸¦ ÀÌ¿ëÇÑ ±¦ÂúÀº ¿¹Á¦Çϳª¸¸ ºÎʵ右´Ï´Ù.

  Hit : 4397     Date : 2012/05/15 01:57



    
minwoo1989 ±¦ÂúÁö´Â ¾ÊÁö¸¸ Çѹø Â¥ºÃ´Âµ¥¿ä...
2^64½Â¸¸ µÅµµ unsigned long long int ÃÖ´ë°ªº¸´Ù Ä¿Áö³×¿ä

#include <stdio.h>
#include <malloc.h>

struct list {
unsigned long long int data;
struct list *next;
};

typedef struct list List;

void insert(List*);

int main() {
List *head = (List*) malloc(sizeof(List));
head->data = NULL;
head->next = NULL;

// unsigned long long intÀÇ ÃÖ´ë°ª
unsigned long long int d = -1;
printf("max = %llu\n\n", d);

insert(head);

while (!head->next) {
printf("%llu", head->data);

tmp = head;
head = head->next;

free(tmp);
}

free(head);

return 0;
}

void insert(List *l) {
List *prev = l;
int i;

l->data = 2;
l->next = NULL;

for (i = 0; i < 127; i++) {printf("2^%d\n", i + 2);
List *d = (List*) malloc(sizeof(List));
d->data = prev->data * 2;
d->next = NULL;
printf("-----%llu\n", d->data);
prev->next = d;
prev = prev->next;
}
}
2012/05/16