>> Edit article
이름
제목
패스워드
: 123456789사이에 사칙연산(+,-,*,/)를 사용하여 합이 100을 : 만드는 문제입니다.. : ex)1+2+3+4+5+6+7+8*9=100 : 123+4*5+6*7+8-9=100 : 이런 식으로 100을 구하면 됩니다..숫자가 12또는 345와 같이 : 합해두 되구여 단,순서는 순서대로 괄호는 적용안됩니다.. : 프로그램 소스를 주시든지, 아님 구한 식을 주시면 감사.. : 내기가 걸렸거든요..지발 부탁드립니다.. 123-45-67+89 1*2-3+4-5+6+7+89 1+2*3-4-5+6+7+89 1-23+4*5+6+7+89 12-3-4+5-6+7+89 1+2+3*4-5-6+7+89 1-23-4+5*6+7+89 12+3+4+5-6-7+89 1*23-4+5-6-7+89 1-23-4-5+6*7+89 123+4-5+67-89 12+3*45+6*7-89 1+2*34-56+78+9 1+2+3-4+5+6+78+9 1*2*3-4+5+6+78+9 1*2+3*4+5-6+78+9 12+3*4-5-6+78+9 1*2*3*4-5-6+78+9 1*2-3+4*5-6+78+9 1+2*3+4+5+67+8+9 12+3-4+5+67+8+9 1-2+3*4+5+67+8+9 1-2-3+4*5+67+8+9 12*3-4*5+67+8+9 1+23-4+56+7+8+9 12+34+5*6+7+8+9 1-2-3+45+6*7+8+9 1*2+34+5+6*7+8+9 12+34-5+6*7+8+9 1*23+4+5+67-8+9 1+2+34-5+67-8+9 1*2+34+56+7-8+9 1+23*4+5-6+7-8+9 12+3*4+5+6+7*8+9 1*2*3*4+5+6+7*8+9 12-3+4*5+6+7*8+9 1-2-3+45-6+7*8+9 1*2+34+5-6+7*8+9 12+34-5-6+7*8+9 12-3-4+5*6+7*8+9 1+23-4+5+6+78-9 1*2+3+4*5+6+78-9 12*3-4+5-6+78-9 1*2+3-4+5*6+78-9 123+45-67+8-9 1+23*4-5+6+7+8-9 123-4-5-6-7+8-9 1-2+3*4*5+6*7+8-9 123+4*5-6*7+8-9 1*2+3+45+67-8-9 1*2*34+56-7-8-9 1-2+3+45+6+7*8-9 1-2+3*4*5-6+7*8-9 1+2+3-45+67+8*9 1*2*3-45+67+8*9 1-2-34+56+7+8*9 1+2+3+4+5+6+7+8*9 1*2*3+4+5+6+7+8*9 1+23-4-5+6+7+8*9 1-2*3+4*5+6+7+8*9 12*3-4-5-6+7+8*9 1+2*3+4*5-6+7+8*9 1-2*3-4+5*6+7+8*9 1+2-3*4+5*6+7+8*9 12+3*4+5+6-7+8*9 1*2*3*4+5+6-7+8*9 12-3+4*5+6-7+8*9 1-2-3+45-6-7+8*9 1*2+34+5-6-7+8*9 12+34-5-6-7+8*9 12-3-4+5*6-7+8*9 1-2*3-4-5+6*7+8*9 1+2-3*4-5+6*7+8*9 1+2+3-4*5+6*7+8*9 1*2*3-4*5+6*7+8*9 1*234+5-67-8*9 1+234-56-7-8*9 1+2+34*5+6-7-8*9 -- % gcc a.c % a.out > z % cat z | bc > z2 z2에서 100인걸 찾으면 됩니다. 소스입니다. 소스는 아래있는 수정을 누르고 보세요. <code> #include <stdio.h> #include <string.h> int main(void) { #define NUM 8 int a[NUM]; int index=0; int i; for(i=0;i<NUM;i++) { a[i]=0; } printf("scale=3"); while(1) { printf("1"); res = 1; for(i=0;i<NUM;i++) { switch(a[i]) { case 0: break; case 1: printf("+"); break; case 2: printf("-"); break; case 3: printf("*"); break; case 4: printf("/"); break; } printf("%d", i+2); } printf(""); a[0]++; index=0; next_index: if(index==NUM) { break; } if( a[index] == 5 ) { a[index] = 0; index++; a[index]++; goto next_index; } } return 0; } </code> -- --;
Copyleft
1999-2026 by
JSBoard Open Project
Theme Designed by
IDOO
All right reserved