forked from QSCTech/zju-icicles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a1f3851
Showing
179 changed files
with
17,268 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
一定要去听 JJM 的复习课! |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
如果有兴趣,可以移步我的博客,查看我的 C 语言易错点清单。 | ||
|
||
http://blog.zhanghai.me/c-exam-notes/ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <stdio.h> | ||
|
||
int main(void) | ||
{ | ||
printf("Hello World!\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <stdio.h> | ||
|
||
int main(void) | ||
{ | ||
printf("What is a computer?\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <stdio.h> | ||
|
||
int main(void) | ||
{ | ||
printf("****\n"); | ||
printf("***\n"); | ||
printf("**\n"); | ||
printf("*\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <stdio.h> | ||
|
||
int main(void) | ||
{ | ||
printf("Welcome to You!\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <stdio.h> | ||
|
||
int main(void) | ||
{ | ||
printf("Programming in C is fun!\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <stdio.h> | ||
|
||
int main(void) | ||
{ | ||
printf("* * * *\n"); | ||
printf(" * * *\n"); | ||
printf(" * *\n"); | ||
printf(" *\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
|
||
int main(void) | ||
{ | ||
int celsius = 37, fahr = 100; | ||
printf("fahr = %d, celsius = %d\n", fahr, celsius); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
|
||
int main(void) | ||
{ | ||
int celsius = 66, fahr = 150; | ||
printf("fahr = %d, celsius = %d\n", fahr, celsius); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
|
||
int main(void) | ||
{ | ||
int celsius = 26, fahr = 78; | ||
printf("celsius = %d, fahr = %d\n", celsius, fahr); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
|
||
int main(void) | ||
{ | ||
int celsius, fahr; | ||
|
||
fahr = GetInteger(); | ||
celsius = 5 * (fahr - 32) / 9; | ||
printf("celsius = %d\n", celsius); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
|
||
int main(void) | ||
{ | ||
int math = 87, eng = 72, comp = 93, average = 84; | ||
printf("math = %d, eng = %d, comp = %d, average = %d\n", math, eng, comp, average); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
#include "simpio.h" | ||
|
||
int main(void) | ||
{ | ||
int a, b, c; | ||
double average; | ||
|
||
a = GetInteger(); | ||
b = GetInteger(); | ||
c = GetInteger(); | ||
average = (a + b + c) / 3.0; | ||
printf("average = %.2f\n", average); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
|
||
int main(void) | ||
{ | ||
int n = 152, digit1 = 2, digit2 = 5, digit3 = 1; | ||
printf("整数%d的个位数字是%d, 十位数字是%d, 百位数字是%d\n", n, digit1, digit2, digit3); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
|
||
int main(void) | ||
{ | ||
int x,y; | ||
printf("9 = 3 * 3\n"); | ||
printf("3 * 3 = 9\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <stdio.h> | ||
#include <math.h> | ||
#include "genlib.h" | ||
#include "simpio.h" | ||
|
||
int main(void) | ||
{ | ||
int money, year; | ||
double interest, rate; | ||
|
||
money = GetInteger(); | ||
year = GetInteger(); | ||
rate = GetReal(); | ||
interest = money * pow(1 + rate, year) - money; | ||
printf("interest = %.2f\n", interest); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
#include "simpio.h" | ||
|
||
int main(void) | ||
{ | ||
int looptimes, ri; | ||
double x, y; | ||
|
||
looptimes = GetInteger(); | ||
for (ri = 1; ri <= looptimes; ++ri) { | ||
x = GetReal(); | ||
y = x == 0 ? 0 : 1 / x; | ||
printf("f(%.2f) = %.1f\n", x, y); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <stdio.h> | ||
#include <math.h> | ||
#include "genlib.h" | ||
|
||
int main(void) | ||
{ | ||
int rep,ri; | ||
double x, y; | ||
|
||
rep = GetInteger(); | ||
for (ri = 1; ri <= rep; ++ri) { | ||
scanf("%lf", &x); | ||
y = x >= 0 ? sqrt(x) : (pow(x + 1, 2) + 2 * x + 1 / x); | ||
printf("f(%.2f) = %.2f\n", x, y); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <stdio.h> | ||
#include <math.h> | ||
#include "genlib.h" | ||
|
||
int main(void) | ||
{ | ||
int rep,ri; | ||
double x, y; | ||
|
||
rep = GetInteger(); | ||
for (ri = 1; ri <= rep; ++ri) { | ||
x = GetReal(); | ||
y = x >= 0 ? sqrt(x) : (pow(x + 1, 2) + 2 * x + 1 / x); | ||
printf("f(%.2f) = %.2f\n", x, y); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
#include "simpio.h" | ||
|
||
int main(void) | ||
{ | ||
int looptimes, ri; | ||
double x, y; | ||
|
||
looptimes = GetInteger(); | ||
for (ri = 1; ri <= looptimes; ++ri) { | ||
x = GetReal(); | ||
y = x != 10 ? x : 1 / x; | ||
printf("f(%.1f) = %.1f\n", x, y); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <stdio.h> | ||
#include <genlib.h> | ||
#include "simpio.h" | ||
|
||
int main(void) | ||
{ | ||
int looptimes, ri; | ||
int x, y; | ||
|
||
looptimes = GetInteger(); | ||
for (ri = 1; ri <= looptimes; ++ri) { | ||
x = GetInteger(); | ||
y = x < 0 ? -1 : (x == 0 ? 0 : 1); | ||
printf("sign(%d) = %d\n", x, y); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
|
||
int main(void) | ||
{ | ||
int i = 0, sum = 5050; | ||
printf("sum = %d\n", sum); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
#include "simpio.h" | ||
|
||
int main(void) | ||
{ | ||
int i, m, sum; | ||
int looptimes, ri; | ||
|
||
looptimes = GetInteger(); | ||
for (ri = 1; ri <= looptimes; ++ri) { | ||
m = GetInteger(); | ||
sum = (m + 100) * (101 - m) / 2; | ||
printf("sum = %d\n", sum); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
#include "simpio.h" | ||
|
||
int main(void) | ||
{ | ||
int choice, i; | ||
double price; | ||
|
||
for (i = 1; i <= 5; ++i) { | ||
printf("[1] apples\n"); | ||
printf("[2] pears\n"); | ||
printf("[3] oranges\n"); | ||
printf("[4] grapes\n"); | ||
printf("[0] Exit\n"); | ||
choice=GetInteger(); | ||
if (choice == 0) { | ||
break; | ||
} else { | ||
switch (choice) | ||
{ | ||
case 1: | ||
price = 3.0; | ||
break; | ||
case 2: | ||
price = 2.5; | ||
break; | ||
case 3: | ||
price = 4.1; | ||
break; | ||
case 4: | ||
price = 10.2; | ||
break; | ||
default: | ||
price = 0; | ||
} | ||
printf("price = %0.1f\n", price); | ||
} | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <stdio.h> | ||
#include "genlib.h" | ||
|
||
int main(void) | ||
{ | ||
int i, sum = 816; | ||
printf("%d", sum); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "stdio.h" | ||
#include "genlib.h" | ||
#include "simpio.h" | ||
|
||
int main(void) | ||
{ | ||
int i, j, n, o, p, q, r; | ||
int looptimes, ri; | ||
|
||
looptimes = GetInteger(); | ||
for (ri = 1; ri <= looptimes; ++ri) { | ||
n = GetInteger(); | ||
/* Print lines */ | ||
o = 2 * n; | ||
/* i is line number */ | ||
for (i = 1; i != o; ++i) { | ||
/* Print leading spaces */ | ||
p = 2 * (n - i); | ||
if (p < 0) { p = -p; } | ||
for (j = 0; j != p; ++j) { printf(" "); } | ||
/* Print asterisks and spaces between */ | ||
q = 2 * i - 1; | ||
r = 2 * n - 1; | ||
if (q > r) { q = 2 * r - q; } | ||
for (j = 0; j != q; ++j) { | ||
if (j != 0) { printf(" "); } | ||
printf("*"); | ||
} | ||
/* Print new line */ | ||
printf("\n"); | ||
} | ||
} | ||
return 0; | ||
} |
Oops, something went wrong.