Skip to content

Fix 404 and adding practices #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added content/cyb/.gitkeep
Empty file.
10 changes: 10 additions & 0 deletions content/cyb/tp/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
weight: 999
title: "TP"
description: "Tp de programmation made in B2B"
icon: "folder"
date: "2024-08-20T12:30:18+02:00"
lastmod: "2024-08-20T12:30:18+02:00"
draft: false
toc: true
---
151 changes: 151 additions & 0 deletions content/cyb/tp/c_basics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
---
title: "Basic"
author: "Clément"
description: "Subjects about C language"
---

# Introduction

This category shows training exercises about C language. For all questions,
please ask on the BackToBasics' [Discord server](https://discord.gg/SJGWzkU2gd).

We cannot use the intranet, so there are somes given files. Please play the
game and do not read the test file. You can download it
[here](https://github.com/BackToBasicsEpita/CyberRef).

A Makefile is already given with these rules:

- `basics`: compiles ;
- `debug`: compiles with debug flags ;
- `check`: runs the testsuite ;
- `clean`: removes all trash files.


You are only allowed to uses the functions defined in the following headers:
- stdio.h

All of the code must be done inside a `basics.c` file.

Your code must compile with the following flags:
`-std=c99 -pedantic -Wall -Wextra -Werror -Wvla`.

Your code must not segfault and have any memory leak.

# FizzBuzz

## Goal

You have to implement the following function:

```c
void fizzbuzz(int n);
```

This function displays on stdout the numbers from 1 to `n` with newlines.
However, it must follow the rules:

- for multiples of 3, it should print *"Fizz"* with a newline ;
- for multiples of 5, it should print *"Buzz"* with a newline ;
- for multiples of 3 and of 5, it should print *"FizzBuzz"* with a newline.

## Example

The output of `fizzbuzz(5)` is:

```bash
1
2
Fizz
4
Buzz
```

# My strlen

You have to implement the following function:

```c
size_t my_strlen(char *s);
```

This functions returns the length of the string argument. The string can be
null, and its size will be 0.

# Binary number

You have to implement the following function:

```c
long binary_number(char str[]);
```

This function returns the integer in decimal corresponding to the binary number
given in argument. If a caracter does not correspond to a binary digit, return
-1.

## Example

The output of `binary_number("110")` is `6`.

The output of `binary_number("This is not correct")` is `-1`.

# Hamming Distance DNA

You have to implement the following function:

```c
int hamming_distance(char *dna1, char *dna2);
```

This function returns the number of differents characters between the two
strings given in arguments.

We read DNA using the letters C,A,G and T. If there is another caracter than
the previous one, return -1. Moreover, if the size of the two parameters are
not equal, return -1.

## Example

The output of `hamming_distance("CAGT", "GAGT")` is `1`.

# Isogram

You have to implement the follwing function:

```c
int is_isogram(char *s);
```

This function returns if the given string is an isogram. An isogram word or
sentence is a word or a phrase without a repetiting letter, however spaces and
non letter caracters are allowed to appear multiple times.

## Example

`House` is an isogram word, but `Test.` is not.

# Move Robot

You have to implement the following function:

```c
struct pair move_robot(struct pair current, char *directions);
```

Moreover, you have to implement the `pair` structure with two integer: `x` and
`y`.

This function moves a robot in the current coordinates on a grid from a string
of directions and returns the new coordinates of the robot.

The string of directions corresponds to a string of operations done on the
robot:

- `U` for up ;
- `L` for left ;
- `D` for down ;
- `R` for right.

## Example

The output of `move_robot({1, 1}, "UL")` is the structure pair `{0, 2}`.
11 changes: 11 additions & 0 deletions content/sup/maths/espaces_vectoriels/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
weight: 999
title: "Espaces Vectoriels"
description: "Cours & redif sur les espaces vectoriels"
icon: "folder"
date: "2024-08-27"
lastmod: "2023-08-26T20:43:23+01:00"
draft: false
toc: true
katex: false
---
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ toc: true
katex: true
---

Ceci est du markdown
Il faut imaginer très fort que c'est un court sur les espaces vectoriels
2 changes: 1 addition & 1 deletion content/sup/maths/moodle.md → content/sup/moodle.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ date: "2023-08-26T20:43:23+01:00"
lastmod: "2023-08-26T20:43:23+01:00"
draft: false

ressource: "https://moodle.cri.epita.fr/course/view.php?id=1491"
ressource: "https://moodle.epita.fr/mod/forum/view.php?id=27403"
---

10 changes: 10 additions & 0 deletions content/sup/tp/S1/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
weight: 999
title: "S1"
icon: "folder"
date: "2024-08-27"
lastmod: "2023-08-26T20:43:23+01:00"
draft: false
toc: true
katex: false
---
87 changes: 87 additions & 0 deletions content/sup/tp/S1/arrays.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
title: "Tableaux"
date: 2023-06-18T00:00:00+02:00
author: "Kolowy"
description: "Entrainements sur les tableaux de tableaux en C#"
---
# Introduction

Ce TP est un sujet d'entrainement pour les tableaux de tableaux en C#.

Si vous avez le mondre probleme n'hésitez pas à aller sur le serveur de l'asso et poser vos questions ou à envoyer un MP à `kolowy_` sur discord

# Code à compléter

```

/// <summary>
/// Calcule la somme de deux tableaux de tableaux d'entiers.
/// </summary>
/// <param name="arrays1">Le premier tableau de tableaux.</param>
/// <param name="arrays2">Le deuxième tableau de tableaux.</param>
/// <returns>Le tableau de tableaux contenant la somme des éléments correspondants.</returns>
/// Il y a une exceptions a gérer dans cette fonction :
/// - Les tableaux de tableaux doivent avoir la même taille
static int[][] SumOfTwoArraysOfArrays(int[][] arrays1, int[][] arrays2)
{
// TODO
throw new NotImplementedException();
}

/// <summary>
/// Affiche les éléments d'un tableau de tableaux.
/// </summary>
/// <param name="array">Le tableau de tableaux à afficher.</param>
static void DisplayArrays(int[][] array)
{
// TODO
throw new NotImplementedException();
}

static void Main()
{
int[][] arrays1 = new int[][]
{
new int[] { 1, 2, 3 },
new int[] { 4, 5, 6 },
new int[] { 7, 8, 9 }
};

int[][] arrays2 = new int[][]
{
new int[] { 10, 11, 12 },
new int[] { 13, 14, 15 },
new int[] { 16, 17, 18 }
};

int[][] sumArrays = SumOfTwoArraysOfArrays(arrays1, arrays2);

Console.WriteLine("Tableaux 1 :");
DisplayArrays(arrays1);

Console.WriteLine("Tableaux 2 :");
DisplayArrays(arrays2);

Console.WriteLine("Somme des tableaux :");
DisplayArrays(sumArrays);
}

Main();
```


Résultat attendu :
```
Tableaux 1 :
1 2 3
4 5 6
7 8 9
Tableaux 2 :
10 11 12
13 14 15
16 17 18
Somme des tableaux :
11 13 15
17 19 21
23 25 27
```
Loading