|
|
|
¸®´ª½ºÆÁ Go Unix Power Tools Online Book
Go Bash Guide
|
|
Read No. 133 article |
2002-03-18 20:05:39 |
|
|
|
|
NickName |
Ç®ºñ´© |
Subject |
[¸®Æ÷Æ®] ÇÇŸÄÚ¶ó½ºÁ¤¸® ¸¸Á·ÇÏ´Â º¯¼ö ±¸Çϱâ (c¾ð¾î) |
|
|
// ÇÇŸ°í¶ó½ºÀÇ Á¤¸®¸¦ ¸¸Á·ÇÏ´Â ¼¼ º¯¼ö¸¦ ã´Â ¹®Á¦
// µÎ º¯¼öÀÇ Á¦°öÀÇ ÇÕÀÌ ´Ù¸¥ ÇÑ º¯¼öÀÇ Á¦°ö°ª°ú °°Àº ¼¼ º¯¼ö¸¦ ã´Â ¹®Á¦ÀÓ
// ºøº¯ º¯¼öÀÇ °ªÀÇ Å©±â(500À» ³ÑÁö¾ÊÀº ¼ö)¿¡ µû¶ó Á¤·ÄµÇµµ·Ï ÇÏ¿´½À´Ï´Ù.
#include <stdio.h>
main() {
int side1,side2,hypotenuse; // ¼¼ º¯¼ö¸¦ ÇÒ´ç
for ( hypotenuse=1 ; hypotenuse <= 500; hypotenuse++ ) { // ºøº¯À» ÃÖ´ë°ªÀ¸·Î ¼³Á¤
for ( side1=1 ; side1 <= hypotenuse ; side1++ ) { // ºøº¯À» ÃÖ´ë°ªÀ¸·Î
¼³Á¤
for ( side2=1 ; side2 <= side1 ; side2++ ) { // Áߺ¹À» ÁÙÀ̱â À§
ÇØ º¯¼öÅ©±â Á¦ÇÑ
if ( side1*side1 + side2*side2 ==
hypotenuse*hypotenuse )
printf ( "%d,%d,%d\n",side2,side1,hypotenuse );
}
}
}
}
|
|
Page Loading [ 0.02 Sec ]
SQL Time [ 0 Sec ]
|
|
|