Skip to content

Commit fd6e601

Browse files
committed
add mathematics folder
1 parent baa9e29 commit fd6e601

File tree

5 files changed

+98
-0
lines changed

5 files changed

+98
-0
lines changed

Mathematics/02-mathematics.pdf

107 KB
Binary file not shown.

Mathematics/1401.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int zeros(int number){
5+
int zero = 0;
6+
7+
for(int i = 5 ; i <= number ; i*=5){
8+
zero += (number / i);
9+
}
10+
11+
return zero;
12+
}
13+
14+
int main(){
15+
int t,x;
16+
cin >> t;
17+
while(t--){
18+
cin >> x;
19+
cout << zeros(x) << endl;
20+
}
21+
}

Mathematics/1779.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <iostream>
2+
#include <cmath>
3+
#include <iomanip>
4+
#define M_PI 3.14159265358979323846
5+
using namespace std;
6+
7+
float solve(float R,int n){
8+
return R/(1.0/sin(M_PI/n)+1.0);
9+
}
10+
11+
int main(){
12+
int t,n,cnt = 1;
13+
float R;
14+
cin >> t;
15+
while(t--){
16+
cin >> R >> n;
17+
cout << "Scenario #" << cnt++ << endl;
18+
cout << setprecision(3) << fixed << solve(R,n) << endl;
19+
}
20+
cout << endl;
21+
}

Mathematics/2242.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <iostream>
2+
#include <cmath>
3+
#include <iomanip>
4+
using namespace std;
5+
6+
const double pi = 3.141592653589793;
7+
8+
double distance(double x1,double y1,double x2,double y2){
9+
return sqrt(pow(x1 - x2,2) + pow(y1 - y2,2));
10+
}
11+
12+
int main(){
13+
double x1,x2,x3,y1,y2,y3;
14+
while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3){
15+
double d1 = distance(x1,y1,x2,y2);
16+
double d2 = distance(x2,y2,x3,y3);
17+
double d3 = distance(x1,y1,x3,y3);
18+
double s = sqrt((d1 + d2 + d3) * (d1 + d2 - d3) * (d2 + d3 - d1) * (d1 + d3 - d2));
19+
double r = (d1 * d2 * d3) / s;
20+
double area = 2 * pi * r;
21+
printf("%4.2f\n", area);
22+
}
23+
}

Mathematics/2262.cpp

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <iostream>
2+
#include <math.h>
3+
using namespace std;
4+
5+
bool isPrime(int number){
6+
for(int i = 2 ; i <= sqrt((double)number) ; i++){
7+
if(number % i == 0){
8+
return false;
9+
}
10+
}
11+
12+
return true;
13+
}
14+
15+
int main(){
16+
int number;
17+
while(cin >> number){
18+
if(number == 0) break;
19+
for(int i = 2 ; i <= number / 2 ; i++){
20+
int flags = 0;
21+
if(isPrime(i)){
22+
flags++;
23+
}else continue;
24+
if(isPrime(number - i)){
25+
flags++;
26+
}
27+
if(flags == 2){
28+
cout << number << " = " << i << " + " << (number - i) << endl;
29+
break;
30+
}
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)