Contact : +88 01840-723661

|

Email : info@jakafind.com

Beecrowd Problem 1000-1020 Solve by C

Beecrowd Problem 1000-1020 Solve by C

Beecrowd-Problem-List
Beecrowd-Problem-List

 

Beecrowd Problem 1000

Your first program in any programming language is usually "Hello World!".
In this first problem all you have to do is print this message on the screen.
Input
This problem has no input.
Output
You must print the message Hello World! and then the endline as shown below.
Input Sample Output Sample
Hello World!
#include <stdio.h>
int main() {
printf("Hello World!\n");
return 0; }

 

Beecrowd Problem 1001

Read 2 variables, named A and B and make the sum of these two variables,
assigning its result to the variable X. Print X as shown below.
Print end line after the result otherwise you will get “Presentation Error”.
Input
The input file will contain 2 integer numbers.
Output
Print the letter X (uppercase) with a blank space before and after the equal signal
followed by the value of X, according to the following example.
Obs.: don't forget the end line after all.
Samples Input Samples Output
10 and 9 X = 19
-10 and 4 X = -6
15 and -7 X = 8
#include <stdio.h>
int main() {
int A, B, X;
scanf("%d %d", &A,&B);
X = A + B;
printf("X = %d\n", X);
return 0;}

 

Beecrowd Problem 1002

The formula to calculate the area of a circumference is defined as A = π . R2.
Considering to this problem that π = 3.14159:
Calculate the area using the formula given in the problem description.
Input
The input contains a value of floating point (double precision), that is the variable R.
Output
Present the message "A=" followed by the value of the variable, as in the example bellow,
with four places after the decimal point. Use all double precision variables.
Like all the problems, don't forget to print the end of line after the result,
otherwise you will receive "Presentation Error".
Input Samples Output Samples
2.00 A=12.5664
100.64 A=31819.3103
150.00 A=70685.7750
#include <stdio.h>
int main() {
double pi = 3.14159;
double R, area;
scanf("%lf", &R);
area = pi * R * R;
printf("A=%.4lf\n", area);
return 0;}

Beecrowd Problem 1003

Read two integer values, in this case, the variables A and B.
After this, calculate the sum between them and assign it to the variable SOMA.
Write the value of this variable.
Input
The input file contains 2 integer numbers.
Output
Print the message "SOMA" with all the capital letters,
with a blank space before and after the equal signal followed
by the corresponding value to the sum of A and B. Like all the problems,
don't forget to print the end of line, otherwise you will receive "Presentation Error"
Input Samples Output Samples
30 and 10 SOMA = 40
-30 and 10 SOMA = -20
0 and 0 SOMA = 0
#include <stdio.h>
int main() {
int A, B, SOMA;
scanf("%d %d", &A, &B);
SOMA = A + B;
printf("SOMA = %d\n", SOMA);
return 0;}

Beecrowd Problem 1003

Read two integer values. After this, calculate the product between them
and store the result in a variable named PROD. Print the result like the example below.
Do not forget to print the end of line after the result,
otherwise you will receive “Presentation Error”.
Input
The input file contains 2 integer numbers.
Output
Print the message "PROD" and PROD according to the following example,
with a blank space before and after the equal signal.
Input Samples Output Samples
3 and 9 PROD = 27
-30 and 10 PROD = -300
0 and 9 PROD = 0
#include <stdio.h>
int main() {
int a, b, prod;
scanf("%d %d", &a, &b);
prod = a * b;
printf("PROD = %d\n", prod);
return 0;}

Beecrowd Problem 1005

Read two floating points' values of double precision A and B,
corresponding to two student's grades. After this, calculate the student's average,
considering that grade A has weight 3.5 and B has weight 7.5
Each grade can be from zero to ten, always with one digit after the decimal point.
Don’t forget to print the end of line after the result,
otherwise you will receive “Presentation Error”. Don’t forget the space before and after the equal sign.
Input
The input file contains 2 floating points' values with one digit after the decimal point.
Output
Print the message "MEDIA"(average in Portuguese) and the student's average
according to the following example, with 5 digits after the decimal point
and with a blank space before and after the equal signal.
Input Samples Output Samples
5.0
7.1
MEDIA = 6.43182
0.0
7.1
MEDIA = 4.84091
10.0
10.0
MEDIA = 10.00000
#include <stdio.h>
int main() {
double A, B, average;
scanf("%lf %lf", &A, &B);
average = ((A * 3.5) + (B * 7.5)) / (3.5 + 7.5);
printf("MEDIA = %.5lf\n", average);
return 0;}

Beecrowd Problem 1006

Read three values (variables A, B and C), which are the three student's grades.
Then, calculate the average, considering that grade A has weight 2,
grade B has weight 3 and the grade C has weight 5
Consider that each grade can go from 0 to 10.0, always with one decimal place.
Input
The input file contains 3 values of floating points (double) with one digit after the decimal point.
Output
Print the message "MEDIA"(average in Portuguese) and the student's average
according to the following example, with a blank space before and after the equal signal.
Input Samples Output Samples
5.0 , 6.0 and 7.0 MEDIA = 6.3
5.0 , 10.0 and 10.0 MEDIA = 9.0
10.0 , 10.0 and 5.0 MEDIA = 7.5
#include <stdio.h>
int main() {
double A, B, C;
double average;
scanf("%lf %lf %lf", &A, &B, &C);
average = (A * 2 + B * 3 + C * 5) / (2 + 3 + 5);
printf("MEDIA = %.1lf\n", average);
return 0; }

Beecrowd Problem 1007

Read four integer values named A, B, C and D. Calculate
and print the difference of product A and B by the product of C and D (A * B - C * D).
Input
The input file contains 4 integer values.
Output
Print DIFERENCA (DIFFERENCE in Portuguese) with all the capital letters,
according to the following example, with a blank space before and after the equal signal.
Input Samples Output Samples
5 , 6 . 7 and 8 DIFERENCA = -26
0 , 0, 7 and 8 DIFERENCA = -56
5 , 6 , -7 , 8 DIFERENCA = 86
#include <stdio.h>
int main() {
int A, B, C, D;
int difference;
scanf("%d %d %d %d", &A, &B, &C, &D);
difference = (A * B) - (C * D);
printf("DIFERENCA = %d\n", difference);
return 0; }

Beecrowd Problem 1008

Write a program that reads an employee's number,
his/her worked hours number in a month and the amount he received per hour.
Print the employee's number and salary that
he/she will receive at end of the month, with two decimal places.

@. Don’t forget to print the line's end after the result,
   otherwise you will receive “Presentation Error”.
@. Don’t forget the space before and after the equal signal and after the U$.

Input
The input file contains 2 integer numbers and 1 value of floating point,
representing the number, worked hours amount and the amount the employee receives per worked hour.
Output
Print the number and the employee's salary, according to the given example,
with a blank space before and after the equal signal.
Input Samples Output Samples
25 , 100 and 5.50 NUMBER = 25
SALARY = U$ 550.00
1 , 200 and 20.50 NUMBER = 1
SALARY = U$ 4100.00
6 , 145 and 15.55 NUMBER = 6
SALARY = U$ 2254.75
#include <stdio.h>
int main(){
int NUMBER,hours;
float amount,SALARY;
scanf("%d %d %f", &NUMBER, &hours, &amount);
SALARY = hours * amount;
printf("NUMBER = %d\n",NUMBER);
printf("SALARY = U$ %0.2f\n", SALARY);//SALARY = U$ 4100.00
return 0; }

Beecrowd Problem 1009

Make a program that reads a seller's name, his/her fixed salary
and the sale's total made by himself/herself in the month (in money).
Considering that this seller receives 15% over all products sold,
write the final salary (total) of this seller at the end of the month , with two decimal places.
@. Don’t forget to print the line's end after the result,
   otherwise you will receive “Presentation Error”.
@. Don’t forget the blank spaces.
Input
The input file contains a text (employee's first name),
and two double precision values, that are the seller's salary and the total value sold by him/her.
Output
Print the seller's total salary, according to the given example.
Input Samples Output Samples
JOAO – 500.00 and 1230.30 TOTAL = R$ 684.54
PEDRO – 700.00 and 0.00 TOTAL = R$ 700.00
MANGOJATA – 1700.00 and 1230.50 TOTAL = R$ 1884.58
#include <stdio.h>
int main(){
double salary, value, total;
char name;
scarf("%s %lf %lf", &name, &salary, &value);
total = salary+value*.15;
printf("TOTAL = R$ %.2lf\n", total);
return 0; }

Beecrowd Problem 1010

In this problem, the task is to read a code of a product 1,
the number of units of product 1, the price for one unit of product 1,
the code of a product 2, the number of units of product 2
and the price for one unit of product 2. After this, calculate and show the amount to be paid.
Input
The input file contains two lines of data. In each line there will be 3 values:
two integers and a floating value with 2 digits after the decimal point.
Output
The output file must be a message like the following example
where "Valor a Pagar" means Value to Pay. Remember the space after ":"
and after "R$" symbol. The value must be presented with 2 digits after the point.
Input Samples Output Samples
12 1 5.30 and 16 2 5.10 VALOR A PAGAR: R$ 15.50
13 2 15.30 and 161 4 5.20 VALOR A PAGAR: R$ 51.40
1 1 15.10 and 2 1 15.10 VALOR A PAGAR: R$ 30.20
#include <stdio.h>
int main() {
int a, b;
double c, res;
scanf("%d %d %lf", &a, &b, &c);
res = b * c;
scanf("%d %d %lf", &a, &b, &c);
res += b * c;
printf("VALOR A PAGAR: R$ %.2lf\n", res);
return 0; }

Beecrowd Problem 1011

Make a program that calculates and shows the volume of a sphere being provided the value of its radius (R) .
The formula to calculate the volume is: (4/3) * pi * R3. Consider (assign) for pi the value 3.14159.
Tip: Use (4/3.0) or (4.0/3) in your formula, because some languages (including C++) assume that
the division's result between two integers is another integer. :)
Input
The input contains a value of floating point (double precision).
Output
The output must be a message "VOLUME" like the following
example with a space before and after the equal signal.
The value must be presented with 3 digits after the decimal point.
Input Samples Output Samples
3 VOLUME = 113.097
15 VOLUME = 14137.155
1523 VOLUME = 14797486501.627
#include <stdio.h>
int main(){
int a;
scanf("%i", &a);
printf("VOLUME = %.3lf\n", (4 * 3.14159 * pow(a, 3)) / 3);
return 0; }

Beecrowd Problem 1012

Make a program that reads three floating point values:
A, B and C. Then, calculate and show:
a) the area of the rectangled triangle that has base A and height C.
b) the area of the radius's circle C. (pi = 3.14159)
c) the area of the trapezium which has A and B by base, and C by height.
d) the area of ​​the square that has side B.
e) the area of the rectangle that has sides A and B.
Input
The input file contains three double values with one digit after the decimal point.
Output
The output file must contain 5 lines of data. Each line corresponds to one of the areas described
above, always with a corresponding message (in Portuguese) and
one space between the two points and the value.
The value calculated must be presented with 3 digits after the decimal point.
Input Samples Output Samples
3.0 4.0 5.2 TRIANGULO: 7.800
CIRCULO: 84.949
TRAPEZIO: 18.200
QUADRADO: 16.000
RETANGULO: 12.000
12.7 10.4 15.2 TRIANGULO: 96.520
CIRCULO: 725.833
TRAPEZIO: 175.560
QUADRADO: 108.160
RETANGULO: 132.080
#include <stdio.h>
int main() {
double a, b, c;
scanf("%lf %lf %lf", &a, &b, &c);
printf("TRIANGULO: %.3lf\n", (a * c) / 2);
printf("CIRCULO: %.3lf\n", c * c * 3.14159);
printf("TRAPEZIO: %.3lf\n", ((a + b) / 2) * c);
printf("QUADRADO: %.3lf\n", b * b);
printf("RETANGULO: %.3lf\n", a * b);
return 0; }

Beecrowd Problem 1013

Make a program that reads 3 integer values and present the greatest one followed
by the message "eh o maior". Use the following formula:
Input
The input file contains 3 integer values.
Output
Print the greatest of these three values followed by a space and the message “eh o maior”.
Input Samples Output Samples
7 14 106 106 eh o maior
217 14 6 217 eh o maior
#include<stdio.h>
int main() {
int a,b,c,major,MaiorAB;
scanf("%d %d %d" ,&a ,&b ,&c);
MaiorAB = (a+b+abs(a-b))/2;
major = (MaiorAB+c+abs(MaiorAB-c))/2;
printf("%d eh o maior",major);
printf("\n");
return 0; }

Beecrowd Problem 1014

Calculate a car's average consumption being provided
the total distance traveled (in Km) and the spent fuel total (in liters).
Input
The input file contains two values: one integer value representing
the total distance (in Km) and the second one is a floating point number Y 
representing the spent fuel total, with a digit after the decimal point.
Output
Present a value that represents the average consumption of a car
with 3 digits after the decimal point, followed by the message "km/l".
Input Sample Output Sample
500
35.0
14.286 km/l
2254
124.4
18.119 km/l
4554
464.6
9.802 km/l
#include <stdio.h>
int main() {
double a, b;
scanf("%lf %lf", &a, &b);
printf("%.3lf km/l\n", a / b);
return 0; }

Beecrowd Problem 1015

Read the four values corresponding to the x and y axes of two points in the plane,
p1 (x1, y1) and p2 (x2, y2) and calculate the distance between them,
showing four decimal places after the comma, according to the formula:
Distance =
Input
The input file contains two lines of data. The first one contains two double values: x1 y1
and the second one also contains two double values with one digit after the decimal point: x2 y2.
Output
Calculate and print the distance value using the provided formula,
with 4 digits after the decimal point.
Input Sample Output Sample
1.0 7.0
5.0 9.0
4.4721
-2.5 0.4
12.1 7.3
16.1484
2.5 -0.4
-12.2 7.0
16.4575
#include<stdio.h>
#include<math.h>
int main() {
double x1,y1,x2,y2,d,x;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
x=((pow((x2-x1),2))+(pow((y2-y1),2)));
d=sqrt(x);
printf("%.4lf\n",d);
return 0; }

Beecrowd Problem 1016

Two cars (X and Y) leave in the same direction. The car X leaves with a constant
speed of 60 km/h and the car Y leaves with a constant speed of 90 km / h.

In one hour (60 minutes) the car Y can get a distance of 30 kilometers from the X car,
in other words, it can get away one kilometer for each 2 minutes.

Read the distance (in km) and calculate how long it takes (in minutes) for
the car Y to take this distance in relation to the other car.
Input
The input file contains 1 integer value.
Output
Print the necessary time followed by the message "minutos" that means minutes in Portuguese.
Input Sample Output Sample
30 60 minutos
110 220 minutos
7 14 minutos

 

#include <stdio.h>
int main() {
int distance;
scanf("%d", &distance);
int time = distance*2;
printf("%d minutos\n", time);
return 0; }

Beecrowd Problem 1017

Little John wants to calculate and show the amount of spent fuel liters on a trip, using a car that does 12 Km/L. For this, he would like you to help him through a simple program. To perform the calculation, you have to read spent time (in hours) and the same average speed (km/h). In this way, you can get distance and then, calculate how many liters would be needed. Show the value with three decimal places after the point.

Input

The input file contains two integers. The first one is the spent time in the trip (in hours). The second one is the average speed during the trip (in Km/h).

Output

Print how many liters would be needed to do this trip, with three digits after the decimal point.

Input Sample Output Sample
10
85
70.833
2
92
15.333
22
67
122.833
#include <stdio.h>
int main() {
double a, b, r;
scanf("%lf %lf", &a, &b);
r = (a * b)/12;
printf("%.3lf\n", r);
return 0; }

Beecrowd Problem 1018

In this problem you have to read an integer value and calculate the smallest possible number of
banknotes in which the value may be decomposed. The possible banknotes are 100, 50, 20, 10, 5, 2 and 1. Print the read value and the list of banknotes.
Input
The input file contains an integer value (0 < < 1000000).
Output
Print the read number and the minimum quantity of each necessary banknotes in Portuguese language,
as the given example. Do not forget to print the end of line after each line,
otherwise you will receive “Presentation Error”.
Input Sample Output Sample
576 576
5 nota(s) de R$ 100,00
1 nota(s) de R$ 50,00
1 nota(s) de R$ 20,00
0 nota(s) de R$ 10,00
1 nota(s) de R$ 5,00
0 nota(s) de R$ 2,00
1 nota(s) de R$ 1,00
11257 11257
112 nota(s) de R$ 100,00
1 nota(s) de R$ 50,00
0 nota(s) de R$ 20,00
0 nota(s) de R$ 10,00
1 nota(s) de R$ 5,00
1 nota(s) de R$ 2,00
0 nota(s) de R$ 1,00
503 503
5 nota(s) de R$ 100,00
0 nota(s) de R$ 50,00
0 nota(s) de R$ 20,00
0 nota(s) de R$ 10,00
0 nota(s) de R$ 5,00
1 nota(s) de R$ 2,00
1 nota(s) de R$ 1,00
#include <stdio.h>
int main(){
int notes, aux;
scanf("%d", &notes);
printf("%d\n", notes);
printf("%d nota(s) de R$ 100,00\n", notes/100);
aux = (notes%100);
printf("%d nota(s) de R$ 50,00\n", aux/50);
aux = (aux%50);
printf("%d nota(s) de R$ 20,00\n", aux/20);
aux = (aux%20);
printf("%d nota(s) de R$ 10,00\n", aux/10);
aux = (aux%10);
printf("%d nota(s) de R$ 5,00\n", aux/5);
aux = (aux%5);
printf("%d nota(s) de R$ 2,00\n", aux/2);
aux = (aux%2);
printf("%d nota(s) de R$ 1,00\n", aux/1);
return 0; }

Beecrowd Problem 1019

Read an integer value, which is the duration in seconds of a certain event in a factory,
and inform it expressed in hours: minutes: seconds.
Input
The input file contains an integer N.
Output
Print the read time in the input file (seconds) converted in hours: minutes: seconds
like the following example.
Input Sample Output Sample
556 0:9:16
1 0:0:1
140153 38:55:53
#include <stdio.h>
int main() {
int seconds;
scanf("%d", &seconds);
int hours = seconds / 3600;
seconds = seconds - (hours * 3600);
int minutes = seconds / 60;
seconds = seconds - (minutes * 60);
printf("%d:%d:%d\n", hours, minutes, seconds);
return 0; }

Beecrowd Problem 1020

Read an integer value corresponding to a person's age (in days) and print it in years, months and days, followed by its respective message “ano(s)”, “mes(es)”, “dia(s)”.

Note: only to facilitate the calculation, consider the whole year with 365 days and 30 days every month. In the cases of test there will never be a situation that allows 12 months and some days, like 360, 363 or 364. This is just an exercise for the purpose of testing simple mathematical reasoning.
Input

The input file contains 1 integer value.

Output
Print the output, like the following example.
Input Sample Output Sample
400 1 ano(s)
1 mes(es)
5 dia(s)
800 2 ano(s)
2 mes(es)
10 dia(s)
30 0 ano(s)
1 mes(es)
0 dia(s)
#include <stdio.h>
int main() {
int total_days, years, weeks, months, days;
scanf("%d", &total_days);
years = total_days / 365;
months = total_days % 365 / 30;
days = total_days % 365 % 30;
printf("%d ano(s)\n%d mes(es)\n%d dia(s)\n", years, months,days);
return 0; }

 

 

Thank You!

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *