From b26ebf88a53dcca7ee41d6bd6f86929c3636728c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20N=C4=99dzy=C5=84ski?= Date: Thu, 5 Dec 2024 12:21:54 +0100 Subject: [PATCH] =?UTF-8?q?Dodanie=20zada=C5=84=20do=20Lab1,=20Lab2,=20Lab?= =?UTF-8?q?3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lab1/binarne.cpp | 15 +++++++++++++++ Lab2/VIP.cpp | 39 +++++++++++++++++++++++++++++++++++++++ Lab3/whilesuma.cpp | 15 +++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 Lab1/binarne.cpp create mode 100644 Lab2/VIP.cpp create mode 100644 Lab3/whilesuma.cpp diff --git a/Lab1/binarne.cpp b/Lab1/binarne.cpp new file mode 100644 index 0000000..98a99bd --- /dev/null +++ b/Lab1/binarne.cpp @@ -0,0 +1,15 @@ +#include +using namespace std; + +int main() { + unsigned long long x; + cin>>x; + + string binary; + while(x>0){ + binary=(x%2==0 ? "0" : "1")+binary; + x/=2; + } + cout< +#include +using namespace std; + +const int MAX_N=500; + +int checkVIP(int friendship[MAX_N][MAX_N], int n) { + int potentialVIP = 0; + for (int i = 1; i < n; i++) { + if (friendship[potentialVIP][i] == 1) { + potentialVIP = i; + } + } + + for (int i = 0; i < n; i++) { + if (i != potentialVIP && (friendship[potentialVIP][i] == 1 || friendship[i][potentialVIP] == 0)) { + return -1; + } + } + return potentialVIP + 1; +} + + +int main(){ + int x;//liczba zestawow + cin>>x; + while(x--){ + int n; + cin>>n; + int friendship[MAX_N][MAX_N]; + for(int i=0;i>friendship[i][j]; + } + } + cout< +using namespace std; + +int main(){ + int n; + int suma=0; + + do{ + cin>>n; + suma= suma+n; + cout<