Algorithm
Problem Name: beecrowd | 2717
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/2717
Elf Time
By Cristhian Bonilha, UTFPR Brazil
Timelimit: 1
The manufacturing of Christmas gifts is a very complicated task. Several times the leprechauns stay up late working so that everything can be done in time and with perfection.
To better manage their schedule, the leprechauns stipulated how many minutes it takes to manufacture each gift.
Its almost the end of the day, and one of the leprechauns asked for your help.
There're N minutes left for the time to go away, and there are two remaining gifts for elf Ed to manufacture. Help him to find out if he will manage to manufacture both gifts today, or if he should delay the work for the next day.
Input
Each test case starts with a integer N, indicating how many minutes there are until the time to go away (2 <= N <= 100).
Following there will be two integers A and B, indicating how many minutes it takes to manufacture each of both gifts Ed has to manufacture (1 <= A, B <= 100).
Output
Print one row, containing the statement "Farei hoje!" if it's possible to manufacture both gifts before the time to go away, or "Deixa para amanha!" otherwise.
Input Samples | Output Samples |
20 |
Deixa para amanha! |
20 |
Farei hoje! |
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include <stdio.h>
int main(void)
{
int a, b, c, x;
scanf("%i %i %i", &a, &b, &c);
x = b+c;
if (x > a)
printf("Deixa para amanha!\n");
else
printf("Farei hoje!\n");
return 0;
}
Copy The Code &
Try With Live Editor
Input
Output
#2 Code Example with C++ Programming
Code -
C++ Programming
#include <iostream>
using namespace std;
int main(){
int n, a, b;
cin >> n >> a >> b;
if (a+b < = n) {
cout << "Farei hoje!" << endl;
}else {
cout << "Deixa para amanha!" << endl;
}
return 0;
}
Copy The Code &
Try With Live Editor
Input
Output
#3 Code Example with Javascript Programming
Code -
Javascript Programming
const { readFileSync } = require("fs")
const [N, A, B] = readFileSync("/dev/stdin", "utf8")
.split(/\s+/, 3)
.map(value => Number.parseInt(value, 10))
console.log(
(A + B) <= N ? "Farei hoje!" : "Deixa para amanha!"
)
Copy The Code &
Try With Live Editor
Input
Output
#4 Code Example with Python Programming
Code -
Python Programming
n = int(input())
a, b = input().split()
if(int(a)+int(b) <= n):
print('Farei hoje!')
else:
print('Deixa para amanha!'>
Copy The Code &
Try With Live Editor
Input
Output