Commit bb0f0b0b by Karl Kivi

troll

parent 8933c9b3
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Draw.io Diagram</title>
<meta http-equiv="refresh" content="0;URL='https://www.draw.io/#G0B7OxzBTIRQtWQWNQQjNzUm91V0U'"/>
<meta charset="utf-8"/>
</head>
<body>
<div class="mxgraph" style="max-width:100%;border:1px solid transparent;" data-mxgraph="{&quot;highlight&quot;:&quot;#0000ff&quot;,&quot;nav&quot;:true,&quot;resize&quot;:true,&quot;xml&quot;:&quot;&lt;mxfile userAgent=\&quot;Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0\&quot; version=\&quot;7.3.7\&quot; editor=\&quot;www.draw.io\&quot; type=\&quot;google\&quot;&gt;&lt;diagram id=\&quot;901debcd-1dda-32dd-963f-84e2fc23e435\&quot; name=\&quot;Page-1\&quot;&gt;7RtZb6M4+NfkcUeAMcdjk3Z2pZ2VRltpd/roBoe4ARwZ02N//dqAIdgkJQkkM1WrqoXP93cfZgYW6evvDG3Xf9EIJzPHil5n4HbmOH5oib8S8FYDPLcCxIxEFchuAffkP1wD63FxQSKcdzpyShNOtl3gkmYZXvIODDFGX7rdVjTprrpFMTYA90uUmNB/ScTXFTSAVgv/A5N4rVa2rbrlES03MaNFVq83c8Cq/KmaU6TmqvvnaxTRlx0QuJuBBaOUV0/p6wInErUKbdW4r3tam30znPFBA0AQroKlH4ZO6C8t/JsH643xN4UMHAnc1K+U8TWNaYaSuxY6Lw+M5ZSWeFvzNBGPtngUu2BvPyT8C1SvD3XbE+b8rSY9KjgVoHb2b5Ru637VfuQm9p6xBuW0YEu852CKjRCLMd/TBzQUEIyNaYrFdsUYhhPEyXN3fVSzWNz0a9EsHmpMD8R6PeczSgqsGEenQpII7sdd/Ar22cr2XByL33PEZfuKJMmCJpSVA4FV/sjOnNEN3mlZreqWenXMOH49jGQTOWqAGlJLPFQc/tLKD6hB6x3RUbBR0en1oO9DMDEYwMTwW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A61vR0m/KdKiiRPQsu+l5aZOAMSDmDRixWg4WcG5LwMiO40XdXOBtPom05aulQ+l75NMOQ6wbnx8OmXOCbKUPwaaD/3ctxJbo12q8x+pxygdXfdYFovCJrBi8Eil4x5Q69z/mtWJKHpIJYR78FypECndNrKiy5yiGVK3LgI8/0OwqCJMNsOTYyBYAqMmd7Mp4k+5gpqqCmLnpLTxUy0un34mdY4jZZ69fCK9SbfzN09V1EFSyIsb7SSWKovgb0ytNgkskabY5IXJVxpOGmnMkEaGZWQvLwKWxWE95V5VdnWYBt17Tuj5YXv6e2K7v3afmAqSquHIOoq1sgUGWB2cRbdyC9BpFglEpHLPe5X8/IwO9apOsVN3cHYoeDv3Kt6+wj2TnXHLBM52kSONtGe/NUY3pVvuhC6jGGZQ98IbclokpDH6hrtocx62V7IwaVtla9CxmT/LaMxQ2kq25qswfVFD3pa4OmbVs1W/N8VvSncOn9Aled00VMVV+uLZQWdqqslfNnq/TsWKhOXdvLWOkpcD8ZAitlOuvt4GaGGXjfH6+qO+1Ch9vSigUqkXUCogx5++RC5UqVhDzJQsEfYp09eqO3tCO6WkSySSlNq0JxSqVPf+whiyDW3ng8kqlFkIxGd4FRoiIvnX5uSwVXyr8G5n/gJlF31Az8PauhU1ZXxP/ATr+0XsJXOab8yBnf/Aw==&lt;/diagram&gt;&lt;/mxfile&gt;&quot;,&quot;toolbar&quot;:&quot;pages zoom layers lightbox&quot;,&quot;page&quot;:0}"></div>
<a style="position:absolute;top:50%;left:50%;margin-top:-128px;margin-left:-64px;" href="https://www.draw.io/#G0B7OxzBTIRQtWQWNQQjNzUm91V0U" target="_blank"><img border="0" src="https://www.draw.io/images/drawlogo128.png"/></a>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<mxfile userAgent="Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0" version="7.3.7" editor="www.draw.io" type="google"><diagram id="901debcd-1dda-32dd-963f-84e2fc23e435" name="Page-1">7Vtbb6M4F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ICpJ68cP45tDiKofxQWSq67sIIZUIH9XfSviuEUSG537NBaJ61W+5fNQRY3XV5hrfcoXvNetX1vGoFIcHOHUBKb5I3n+FKxjqy4Hj3t86E/fT7tkg3eu/spfqOehI9bfupcJr+wVsVb39jNj9/D8=</diagram></mxfile>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
srand(time(NULL));
int maxn = 10;
int maxm = 3;
int A[maxn][maxm];
int negarv = 0;
int negSumRida[4];
int i = 0;
int j = 0;
int negSum;
for(i = 6; i < maxn; i++) {
for(j = 0; j < maxm; j++) {
printf("sisesta %d. rea %d. liige : ", i+1,j+1);
scanf("%d", &A[i][j]);
//A[i][j] = rand() % 200 -100;
//printf("%d \n", A[i][j]);
if (negarv == 0 && A[i][j] < 0) {
negarv = 1;
}
}
}
if (negarv == 0) {
printf("\nMatriksis pole negatiivseid arve, mida kokku summeerida\n");
return;
}
for(i = 6; i < maxn; i++) {
negSum = 0;
for(j = 0; j < maxm; j++) {
if (A[i][j] < 0) {
negSum += A[i][j];
}
}
negSumRida[i-6] = negSum;
}
for (i = 0; i < 4; i++) {
printf("\n%d. rea summa on %d\n",i+7,negSumRida[i]);
}
}
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
srand(time(NULL));
int n;
int j;
int i = 0;
int sum;
int swap = 0;
int k;
int h;
do {
printf("n: ");
scanf("%d", &n);
} while(n < 2);
int H[n][5];
float A[n];
for (i = 0;i<n;i++) {
for (j=0; j<5;j++) {
H[i][j] = rand() % 5;
printf("%d. tulba %d. liige on %d\n",i+1, j+1, H[i][j]);
}
printf("\n");
}
j = 0;
i = 0;
printf("sorted lists\n");
for (;i<n;i++) {
for( k = 0; k < 4; k++) {
for( h = 0; h < 4 - k;h++) {
if (H[i][h] > H[i][h+1]) {
swap = H[i][h];
H[i][h] = H[i][h+1];
H[i][h+1] = swap;
}
}
}
}
for (i = 0; i<n;i++) {
for (j= 0; j<5;j++) {
printf("%d. tulp %d. liige on %d\n",i+1,j+1,H[i][j]);
}
printf("\n");
}
for (i = 0; i<n;i++) {
sum = 0;
for (j = 1;j<4;j++) {
sum = sum + H[i][j];
}
A[i] = (double) sum/3;
}
for (i = 0;i<n;i++) {
printf("%d. keskv22rtus on %f\n", i+1, A[i]);
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
srand(time(NULL));
int n;
int j;
int i = 0;
int sum;
int swap = 0;
int k;
int h;
do {
printf("n: ");
scanf("%d", &n);
} while(n < 2);
int H[n][5];
float A[n];
for (i = 0;i<n;i++) {
for (j=0; j<5;j++) {
H[i][j] = rand() % 5;
printf("%d. tulba %d. liige on %d\n",i+1, j+1, H[i][j]);
}
printf("\n");
}
j = 0;
i = 0;
printf("sorted lists\n");
for (;i<n;i++) {
for( k = 0; k < 4; k++) {
for( h = 0; h < 4 - k;h++) {
if (H[i][h] > H[i][h+1]) {
swap = H[i][h];
H[i][h] = H[i][h+1];
H[i][h+1] = swap;
}
}
}
}
for (i = 0; i<n;i++) {
for (j= 0; j<5;j++) {
printf("%d. tulp %d. liige on %d\n",i+1,j+1,H[i][j]);
}
printf("\n");
}
for (i = 0; i<n;i++) {
sum = 0;
for (j = 1;j<4;j++) {
sum = sum + H[i][j];
}
A[i] = (double) sum/3;
}
for (i = 0;i<n;i++) {
printf("%d. keskv22rtus on %f\n", i+1, A[i]);
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
srand(time(NULL));
char *kaardid[13] = {"2","3","4","5","6", "7","8","9","10","J","Q", "K", "A"};
char *cV6etud[13];
char *pV6etud[13];
int pCount = 0;
int cCount = 0;
int player = 0;
int computer = 0;
int i = 0;
int lost = 0;
for (; i< 2; i++) {
cV6etud[i] = kaardid[(rand() % 13)];
pV6etud[i] = kaardid[(rand() % 13)];
pCount++;
cCount++;
}
for (i = 0; i < 2; i++) {
if (cV6etud[i] == "J" || cV6etud[i] == "Q" || cV6etud[i] == "K"||cV6etud[i] == "A" ) {
if (cV6etud[i] == "A") {
if (computer == 11) {
computer = computer + 1;
} else {
computer = computer + 11;
}
} else {
computer = computer + 10;
}
} else {
computer = computer + atoi(cV6etud[i]);
}
if (pV6etud[i] == "J" || pV6etud[i] == "Q" || pV6etud[i] == "K" || pV6etud[i] == "A") {
if (pV6etud[i] == "A") {
if (player == 11) {
player = player + 1;
} else {
player = player + 11;
}
} else {
player = player + 10;
}
} else {
player = player + atoi(pV6etud[i]);
}
}
printf("Arvuti: %d [ ", computer);
for (i = 0; i < cCount; i++) {
printf("%s ", cV6etud[i]);
}
printf ("] \n");
printf("Sina: %d [ ", player);
for (i = 0; i < pCount; i++) {
printf("%s ", pV6etud[i]);
}
printf ("] \n");
if (player == 21) {
printf("Palju 6nne v6itsid arvutit!\n");
lost = 1;
}
if (computer == 21) {
printf("Arvuti v6itis, sa kaotasid!\n");
lost = 1;
}
while (lost == 0) {
printf("siin peaks programm t66tama!\n");
lost = 1;
}
}
n= 4
processRowsBefore = 2
A = [[2,3,-4,3],[1,2,-3,4],[1,2,3,4],[1,2,3,4]]
#Ridade positiivsete elementide summa leidmine
rowSums = []
for row in range(processRowsBefore-1):
rowSum = 0;
for col in range(n):
if A[row][col]>0:
rowSum += A[row][col]
rowSums.append(rowSum)
# Tulemuste v2ljastamine
for i in range(len(rowSums)):
#print(str(rowSums[i]))
print("summa: %d ")%rowSums[i]
#include <stdio.h>
int main(void) {
int PSum = 0;
int KSum = 0;
int A[4][4] = {{1,2, 3,2}, {1,2,2,4}, {1,2,3,4}, {2,2,3,4}};
for (int i = 0; i <= 3;i++) {
PSum += A[i][i];
KSum += A[0+i][3-i];
}
if (PSum < KSum) {
printf("KSum on %d \n", KSum);
printf("PSum on %d \n", PSum);
} else {
printf("PSum on %d \n", PSum);
printf("KSum on %d \n", KSum);
}
return 0;
}
#include <stdio.h>
// Ülesande tekstis antud väärtused
int n = 4;
int rowSums[4];
int i; int j;
int rowsum = 0;
int A[4][4] = {{2,3,-4,3},{1,2,-3,0},{1,2,3,4},{1,2,3,4}};
int main(void) {
for (i= 0;i<n;i++) {
rowsum = 0;
for (j = 0;j<n;j++) {
if (A[i][j] > 0) {
rowsum += A[i][j];
}
}
rowSums[i] = rowsum;
}
// prindi tulemused
for (i = 0; i<4; i++) {
printf("%d \n", rowSums[i]);
}
}
#include <stdio.h>
int n = 4; int m = 3;
int A[4][3] = {{5,-3,-12},{2,3,-2},{1,-6,8},{-4,-13,4}};
void negSummad(void);
void trykiMaatriks(int n, int m, int [n][m]);
int main(void) {
trykiMaatriks(n,m, A);
negSummad();
return 0;
}
void trykiMaatriks(int n, int m, int A[n][m]) {
int i = 0;
int j = 0;
while ( i<n) {
j=0;
while(j<m) {
printf("%4d", A[i][j]);
j++;
}
printf("\n");
i++;
}
}
void negSummad(void) {
int i=0;
int j=0;
int negsum[m];
printf("Tulpade negatiivsete elementide summad on:\n");
while (j<m)
{
i= 0;
negsum[j]=0;
while(i<n)
{
if (A[i][j]<0)
{
negsum[j]+=A[i][j];
}
i++;
}
printf("%4d", negsum[j]);
j++;
}
printf("\n");
}
#include <stdio.h>
int main(void)
{
int S = 0, i = 0, input = 0, N;
do
{
printf("Sisesta rea pikkus: \n");
scanf("%d", &N);
} while ( N <= 0);
int A[N];
do
{
printf("Sisesta %d : ", i);
scanf("%d", &input);
A[i] = input;
i++;
}
while (i < N);
i = 0;
do
{
S = S + A[i];
i++;
}
while ( A[i] > 0 && i < N );
printf("Tulemus : %d \n", S);
return 0;
}
#include <stdio.h>
#include <math.h>
int main(void) {
int arv;
int n=1;
int max2 = 1;
int i;
printf("sisesta arv:");
scanf("%d", &arv);
do {
//printf("%d \n",n);
n++;
max2 = max2 * 2;
} while ( arv > max2);
int B[n];
i = 0;
do {
if ( arv >= max2)
{
//printf("k");
B[i] = 1;
arv = arv - max2;
} else {
//printf("s");
B[i] = 0;
}
max2 = max2 / 2;
//printf("%d \n", B[i]);
i++;
} while (i < n);
for (i = 0; i < n; i++) {
printf("%d ", B[i]);
}
printf("\n");
return 0 ;
}
#include <stdio.h>
#include <math.h>
int main(void) {
int arv;
int tul;
printf("arv: ");
scanf("%d", &arv);
if (arv == 0) {
printf("0 \n");
return 0;
}
int length = log10(arv) + 1;
int A[length];
int i = 0;
while (arv > 0) {
int digit = arv % 10;
A[i] = digit;
arv /= 10;
i++;
}
/*for (i = 0; i < length; i++) {
printf("%d ", A[i]);
}*/
i = 0;
int j = length;
do {
tul += pow(2, (j-1))*A[j-1];
i++;
j--;
} while (i < length);
printf("%d \n", tul);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment