#include <stdio.h>
#include <math.h>
int gcd(int m, int n) {
if (n == 0) return m;
return gcd(n, m % n);
}
int main(){
float a; int b, c;
for (int j=5; j<=500; j++) {
b=j*j;
for (int i=1; i<=j*sqrt(2)/2; i++) {
c = a = sqrt(b-i*i);
if (a==c && gcd(c,i)==1)
printf("%d %d %d\n", i, c, j);
}
}
}
3 4 5
5 12 13
8 15 17
7 24 25
20 21 29
12 35 37
9 40 41
28 45 53
11 60 61
16 63 65
33 56 65
48 55 73
13 84 85
36 77 85
39 80 89
65 72 97
20 99 101
60 91 109
15 112 113
44 117 125
88 105 137
17 144 145
24 143 145
51 140 149
85 132 157
119 120 169
52 165 173
19 180 181
57 176 185
104 153 185
95 168 193
28 195 197
84 187 205
133 156 205
21 220 221
140 171 221
60 221 229
105 208 233
120 209 241
32 255 257
23 264 265
96 247 265
69 260 269
115 252 277
160 231 281
161 240 289
68 285 293
136 273 305
207 224 305
25 312 313
75 308 317
36 323 325
204 253 325
175 288 337
180 299 349
225 272 353
27 364 365
76 357 365
252 275 373
135 352 377
152 345 377
189 340 389
228 325 397
40 399 401
120 391 409
29 420 421
87 416 425
297 304 425
145 408 433
84 437 445
203 396 445
280 351 449
168 425 457
261 380 461
31 480 481
319 360 481
44 483 485
93 476 485
132 475 493
155 468 493
請撰寫一程式,讓使用者輸入三個正整數,分別為西元年、月、日,請計算此日期為當年的第幾天,需注意閏年;若輸入的日期有誤,請輸出「error」。 閏年: 西元年份除以4不可整除,為平年。 西元年份除以4可整除,且除以100不可整除,為閏年。 西元年份除以100可整除,且除以400不可整除,為平年。 西元年份除以400可整除,為閏年。 輸入說明 三個正整數,分別為西元年、月、日 輸出說明 此日期為當年的第幾天
Jul 14, 2023https://web.ntnu.edu.tw/~algo/Prime.html #include <stdio.h> //4 #include <math.h> #define N 100 //20000000 int sieve[N]={1,1}; // 1代表不是質數, 0代表是質數 void main() //eratosthenes { // 只需要刪掉sqrt(N)以下的質數的倍數。 for (int i=2; i<=sqrt(N); i++) if (!sieve[i])
Jun 20, 2023// Fig. 10.3: fig10_03.c // Card shuffling and dealing program using structures #include <stdio.h> #include <stdlib.h> #include <time.h> #define CARDS 52 #define FACES 13 struct card {const char *face,*suit;};
Jun 20, 2023#TQC-Python 1 #8月2日 https://www.facebook.com/buddin5678/posts/pfbid025PJyB7QKfv7nSyK7ZARHmBFYJ2FwJiR2kx5e13ydgmBPmTXt4z18hojs55vk9poTl #PYA102.py 格式化輸出 #23.12 395.3 100.4617 564.329 ''' a = float(input()) b = float(input()) c = float(input()) d = float(input())
Jun 8, 2023or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up