Skip to content

Instantly share code, notes, and snippets.

View rodolfoghi's full-sized avatar

Rodolfo Ghiggi rodolfoghi

View GitHub Profile
@rodolfoghi
rodolfoghi / andandoNoTempoJS.js
Created September 12, 2017 18:39
Problema A: Andando no tempo Maratona de Programação da SBC – ACM ICPC – 2016.
var numbers = window.prompt().split(' ').map(function(x){
return parseInt(x);
});
if ((numbers[0] + numbers[1] < numbers[2]) || (numbers[0] + numbers[2] < numbers[1]) || (numbers[1] + numbers[2] < numbers[0])) {
alert("N");
} else {
alert("S");
}
numbers = [int(x) for x in input().split(' ')]
if ((numbers[0] + numbers[1] < numbers[2]) | (numbers[0] + numbers[2] < numbers[1]) | (numbers[1] + numbers[2] < numbers[0])):
print("N")
else:
print("S")
using System;
using System.Linq;
class MainClass {
public static void Main (string[] args) {
var numbers = Console.ReadLine()
.Split(' ')
.Select(str => Convert.ToInt32(str))
.ToArray();
if ((numbers[0] + numbers[1] < numbers[2]) || (numbers[0] + numbers[2] < numbers[1]) || (numbers[1] + numbers[2] < numbers[0])) {
@rodolfoghi
rodolfoghi / caca-fantasma01.html
Created July 12, 2018 15:13
HTML básico para o jogo de caça fantasmas
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Caça fantasmas</title>
</head>
<body>
<div id="palco">
<!-- Código omitido -->
<style>
#palco {
/* Nosso palco ocupará 80% da largura e 80% da altura da tela. */
width: 80%;
height: 80vh;
/* Define a imagem a ser utilizada como pano de fundo. */
background-image: url('floresta.png');
/* A imagem deve cobrir a div inteira, tanto em altura como em largura. */
background-size: cover;
<!-- Código omitido -->
<div id="palco">
<img src="fantasma1.svg" alt="Fantasma número 1" id="fantasma1">
</div>
<!-- Código omitido -->
<script>
/**
* Pega a imagem com id fantasma1 e salva em uma variável
* para que seja possível manipularmos com JavaScript.
*/
const $fantasma1 = document.getElementById("fantasma1");
// Esconde a imagem fantasma1.
function esconda() {
$fantasma1.style.display = "none";
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Caça fantasmas</title>
<style>
#palco {
#fantasma1 {
position: relative;
}
// Constante referente ao palco
const $palco = document.getElementById('palco');
// https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Math/random
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
}