 Ushtimet mund të punohen vetëm në Python, C++, C ose Java.

Nëse keni nevojë për një compiler online, përdorni repl.itDorëzimi i përgjigjeve duhet të kryhet përmes dërgimit të kodit në format .txt (i.e copy-dhe-paste kodin ne Notepad) bashkangjitur me emerin, mbiemrin dhe Gjuhën e zgjedhur ne emailin tone - alphaplan.contact@gmail.com - duke klikuar butonin Dorëzo.

Në total janë 5 ushtrime, 1 për çdo ditë të javës, dhe një ushtrim më sfidues në fundjavë. Ushtrimet gjatë javës vlejnë 1 pike, ndërsa ai i fundjavës 5 pikë. Pergjigjet e sakta marrin pike të plota ndersa ato jo të plota marrin 0.5 pikë.

Fillojmë! Ushtimet mund të punohen vetëm në Python, C++, C ose Java.

Nëse keni nevojë për një compiler online, përdorni repl.itDorëzimi i përgjigjeve duhet të kryhet përmes dërgimit të kodit në format .txt (i.e copy-dhe-paste kodin ne Notepad) bashkangjitur me emrin, mbiemrin dhe Gjuhën e zgjedhur ne emailin tone - alphaplan.contact@gmail.com - ose duke klikuar butonin Dorëzo.

Në total janë 6 ushtrime, 1 për çdo ditë të javës, dhe një ushtrim më sfidues në fundjavë. Ushtrimet gjatë javës vlejnë 1 pike, ndërsa ai i fundjavës 5 pikë. Pergjigjet e sakta marrin pike të plota ndersa ato jo të plota marrin 0.5 pikë.

Fillojmë! Question: You are given the sizes of 3 items and their downloaded amounts. Find the one which has been downloaded the most and find the the percentage of the remaining.

Input specification: You will be first given 3 integer numbers, the total amounts of three files (at,bt,ct). On the next line, you will be given 3 other integers the amounts downloaded (ad,bd,cd). All the numbers are integers not greater than 10 million.

Output specification: Show two floating point numbers with two digits precision.

Explanation: The first file is totally 50KB and 30KB has been downloaded (60% of the file has been downloaded, The 90% of the second file and 70% of the third file has been downloaded). So, the second file has been downloaded the most with 90.0%. The total amount to download is (50+70+100) 220KB and 163 KB has been downloaded. Thus, 163/220 ⇒ 74.09% of all files has been downloaded.  Question:

Write a program that asks the user to enter the total sales of the day for the stores in three different cities of Albania (Tirana, Durres and Shkoder). The program should then display a bar graph comparing each store's sales.

Create each bar in the graph by displaying a row of asterisks. Each asterisk should represent \$100 of sales.

Input specification

You will be given three integer numbers (sale) in three lines where 0 < sale < 1000.

Output specification

Show three lines containing Asterisk chars '*' for every \$100 sale.  In a page you have the statistics of Tirana derbies between two teams. In a match,

• if a team scores more goals than the other team, the winning team gets 3 points and the losing team gets 0 points.

• If they cannot score any goal or if they score the same number of goals, each team gets 1 point.

The team which collects more points is the winner. If they have the same number of points the team which scored more goals is the winner. Otherwise print zero '0'.

Question: Read the given information for n matches and define the winner.

Input specification

First you will be given the number of matches (n) where n is between 0 and 2500. Then, in the following n lines you will be given two integers.

Output specification

Show 1, if the first team wins. Show 2, if the second team wins. Show zero '0' otherwise.

Explanation: First team won two matches (6 points and scored 14 goals), and the second team won three matches (9 points and scored 13 goals). So, the second team wins.   Question: There are several stations and many people get on and off the train. For each person in every station, you are given the number of stations that he travels. Find the station on which the most number of people get off the train.

Input specification: In the first line, you will be given an integer: the number of stations (n). Then in the following n lines, you will be given several integers ending with a negative number. Each number represents the number of stations that this person is going to travel where 1 ≤ n ≤ 1,000 and you have at most 100 people on every station.

Output specification: Show one integer. If there are several stations with the same max number of people, show the number of the first  station.

Explanation: There are four stations. In starting station (station 0), There are 3 people getting on the train. The first one will get off after 3 stations, the second person will get off after 4 stations. There is person getting off on the first station. Here is the chart showing the number of people getting off on each station.  Write a program, which asks for a student score. Score is a number from 0-100. Translate the score into grade according to the next limits:

score >= 90 is "A"

score >= 80 is "B"

score >= 70 is "C"

score >= 60 is "D"

anything else is "F"

if the score is 100 print "Perfect score!”

Input: A positive integer number.

Output: The letter grade or "Perfect score!” for 100 points ;  Mr. Enea, sells building and sanitary materials. He stores all the products when bought in a room. And, while selling he processes through his stock book. But, he wants to renew his system and to pass to computerized system.

Question: Write a program that is going to read the stock information. And, decide the most profited (mostProfited) material and the number of remaining products (numRemained) in the store.

The profit of a certain product = (The number of items sold) * (Sell price - Entry price)

Note:

1. mostProfited: is the item which has the biggest sum of profit

2. numRemained: Some products are all sold. Every other item is an item remained in the stock. numRemained is the count of the items remained in the stock.

Input specification

First, you will be given a number n, where 1 < n ≤ 5000, that shows the number of items in the store. Then, in the following n lines you will be given semicolon separated product information. Product name and category are string fields that may contain any ASCII char ending with a semicolon. Every line contains

1. Product ID: Every product is given a product ID on its entry. an integer number smaller than 10 million

2. Product name: At most 40 chars string (possibly space separated)

3. Product category: At most 40 chars string (possibly space separated)

4. Entry price: a floating point number

5. Sell price: a floating point number

6. Stock entry amount: The number of items when product first entered to the system, an integer number

7. Amount sold: The number of items sold on different days. Space separated series of integers ending with a semicolon

The stock entry amount is an integer less than 10000 and the sum of the amount sold will never exceed the stock entry amount. and 10000

Output specification

Show the amount of the profit for the mostProfited product, and the number of (grand total of) remaining products.

Sample Input I

5

1; Flexible Pipe Connectors 6"; Connectors; 26.43; 34.62; 78; 3 9 6 2 9 2 4;

2; Barbed Fittings 4"; Fittings; 9.88; 10.96; 32; 5 6 9 7 5;

3; Small Tube Push Fit 7"; Fittings; 14.75; 17.85; 37; 2 8 4 3 5 8 7;

4; Clear Shower Mirrors 24"; Mirrors; 24.13; 29.19; 72; 4 4 3 3 5 6 9;

5; Lead Free Brass 4"; Fittings; 6.89; 9.64; 98; 3 5 6 4 3 7;

Sample Output I

286.65 3

Output Explanation :

Products 2 and 3 are all sold. There are 43 items remaining from Product 1; 38 items remaining from product 4 and 70 items remaining from product 5. Thus, numRemained = 3

Product 1 is sold from the price \$34.62 and its entry price is \$26.43. The profit per item is \$8.19 and it has been sold 35 pieces. MaxProfitAmount = (35 * 8.19) = 286.65

## ​

Zgjidhja Ushtrimi 1

#include <stdio.h>

int main()

{

int a, b, c, d, e, f;

scanf("%d %d %d" , &a, &b, &c);

scanf("%d %d %d" , &d, &e, &f);

double p1 = (double) d/a;

double p2 = (double) e/b;

double p3 = (double) f/c;

double max =p1, res;

if(p2>max)max=p2;

if(p3>max)max=p3;

res = (double) (d+e+f)/(a+b+c);

printf("%.2f %.2f" , max*100, res*100 );

return 0;

}

Zgjidhja Ushtrimi 2

Sales Bar Chart (C++)

#include <iostream>

using namespace std;

void draw(int a)

{

a=a/100;

for(int i=0;i<a; i++)

cout<<'*';

cout<<endl;

}

int main ()

{

int a,b,c;

cin>>a>>b>>c;

draw(a);

draw(b);

draw(c);

return 0;

}

Zgjidhja Ushtrimi 3

Derby Tirana (C++)

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

int n,goals1,goals2,points1=0,points2=0,sum1=0,sum2=0;

cin>>n;

while (n-->0){

cin>>goals1>>goals2;

sum1+=goals1;sum2+=goals2;

if (goals1>goals2 ){points1=points1+3;}

else if (goals2>goals1){points2=points2+3;}

else if (goals1==goals2){points1++;points2++;}

}

if (points1>points2){cout<<1;}

if (points1==points2&&sum1==sum2){cout<<0;}

else if (points2>points1){cout<<2;}

else if (points2==points1){

if (sum1>sum2)cout<<1;

else if (sum2>sum1)cout<<2;

}

}

Zgjidhja Ushtrimi 4

Most Crowded Station

#include <bits/stdc++.h>

using namespace std;

ifstream fin("input.txt");

int main()

{

int stations={0};

int n, st;

fin>>n;

for(int i=0;i<n;i++){

fin>>st;

while(st>0){

stations[st+i]++;

fin>>st;

}

}

int Max=stations, pos=0;

for(int i=1;i<=n;i++){

//cout<<stations[i]<<" ";

if(Max<stations[i])

{

Max=stations[i];

pos=i;

}

}

cout<<endl<<pos<<endl;

return 0;

}

Zgjidhja Ushtrimi 5

Translate into grade (C )

#include <stdio.h>

#include <stdlib.h>

int main()

{

int score;

scanf("%d",&score);

if(score==100)printf ("Perfect score!");

else if(score>=90)printf("A");

else if(score>=80)printf("B");

else if(score>=70)printf("C");

else if(score>=60)printf("D");

else printf("F");

return 0;

}

Zgjidhja Ushtrimi 6

Challenge Exercise

#include <iostream>

#include <cstdlib>

using namespace std;

struct product

{

int id;

string name, cat;

float eprice, sprice;

int amount;

};

void quickSort(product pr[], int left, int right)

{

int i = left, j = right;

int tmp, tmp1;

int k=abs((left + right) / 2);

int pivot = pr[k].amount;

int pivot1=pr[k].id;

while (i <= j)

{

while (pr[i].amount < pivot)

i++;

while (pr[j].amount > pivot)

j--;

if (i <= j)

{

tmp = pr[i].amount;

tmp1=pr[i].id;

pr[i].amount = pr[j].amount;

pr[i].id=pr[j].id;

pr[j].amount = tmp;

pr[j].id=tmp1;

i++;

j--;

}

}

if (left < j)

quickSort(pr,left, j);

if (i < right)

quickSort(pr, i, right);

}

int main()

{

int n, top, sum;

char a, b, c, d;

cin>>n>>top;

product p[n];

for(int i=0; i<n; i++)

{

sum=0;

cin>>p[i].id>>a;

getline(cin,p[i].name,';');

getline(cin, p[i].cat, ';');

cin>>p[i].eprice>>b;

cin>>p[i].sprice>>c;

for(int j=0; j<5; j++)

{

cin>>p[i].amount;

sum+=p[i].amount;

}

cin>>d;

p[i].amount=sum;

}

quickSort(p, 0, n-1);

for(int i=n-1; i>=n-top; i--)

{

cout<<p[i].id<<" "<<p[i].amount<<endl;

}

return 0;

}