Borked the gpg signing :(
This commit is contained in:
71
PI/Ćwiczenia/20221107120342.md
Normal file
71
PI/Ćwiczenia/20221107120342.md
Normal file
@@ -0,0 +1,71 @@
|
||||
∈# Na ile sposobów można przedstawić liczbę 5?
|
||||
5
|
||||
4+1
|
||||
3+2
|
||||
3+1+1
|
||||
2+2+1
|
||||
2+1+1+1
|
||||
1+1+1+1+1
|
||||
|
||||
## Reprezentacja w C++
|
||||
```cpp
|
||||
int f(int m,int m){
|
||||
if(m==1 || n ==1){
|
||||
return 1;
|
||||
} else if (m>n){
|
||||
return f(m-n,n)+f(m,n-1)
|
||||
}else{
|
||||
return 1+f(m,m-1)
|
||||
}
|
||||
}
|
||||
```
|
||||
### Stos:
|
||||
![[20221107120342 2022-11-07 12.08.17.excalidraw]]
|
||||
|
||||
# Trójkąt Sierpińskiego
|
||||
## Grafika:
|
||||
![[20221107120342 2022-11-07 12.15.53.excalidraw]]
|
||||
|
||||
## Kod:
|
||||
```cpp
|
||||
void tr(double bok, double min){
|
||||
if(bok>min){
|
||||
for(int i=0;i<3,i++){
|
||||
tr(bok/2, min);
|
||||
rysuj(bok);
|
||||
obrot(120);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
# Drzewo:
|
||||
## Rysunek
|
||||
![[20221107120342 2022-11-07 12.22.55.excalidraw]]
|
||||
## Kod:
|
||||
```cpp
|
||||
void galaz(double a){
|
||||
rysuj(a);
|
||||
obrot(45);
|
||||
galaz(2a/3.0);
|
||||
obrot(-90);
|
||||
galaz(2a/3.0);
|
||||
obrot(-135);
|
||||
rysuj(a);
|
||||
obrot(180);
|
||||
}
|
||||
```
|
||||
# Problem skoczka szachowego:
|
||||
## Rysunek:
|
||||
![[20221107120342 2022-11-07 12.48.52.excalidraw]]
|
||||
## Kod:
|
||||
```cpp
|
||||
const n = 8;
|
||||
int Sz[n][n];
|
||||
int dx[8]={1,2,2,1,-1,-2,-2,-1};
|
||||
int dy[8]={2,1,-1,-2,-2,-1,1,2};
|
||||
bool Probuj(int x, int y, int nr){
|
||||
Sz[x][y]=nr;
|
||||
if(nr==n*n) return true;
|
||||
for (int i = 0;i<n;i++)
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user