Giter Site home page Giter Site logo

mateus-sm / beecrowd-solved Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 590 KB

Repository destined to document BeeCrowd problems.

Home Page: https://www.beecrowd.com.br/judge/pt/profile/571361

License: MIT License

C 68.45% Python 28.68% Java 2.87%
beecrowd beecrowd-solution-in-c

beecrowd-solved's Introduction

Mateus' hub

Tech Student

  • ⚙️ Information Systems Student at UNOESTE - University of Western São Paulo.
  • 🌱 Learing AutoHotKey v2.
  • 🪴 Knowlege in C, C++, HTML, CSS, AutoHotKey v1, Python, SQL and R.
  • ✉️ Email: [email protected]

Linkedin Badge BeeCrowd Badge

Mateus-sm

beecrowd-solved's People

Contributors

mateus-sm avatar

Watchers

 avatar

beecrowd-solved's Issues

1045.c Erro 15%

Olá meu caro, espero que esteja bem.
Embora aqui no repositório ainda não tenha o código do Problema 1045, eu vi no seu perfil do Beecrowd que o seu código foi aceito.

Eu estou num impasse neste exercício desde as 14h de ontem - pois o meu dá, sempre, 15% de erro, mostrando as seguintes diferenças:

  • meu código está passando um "NAO FORMA TRIANGULO" quando, deveria passar OBTUSANGULO E ISOSCELES.
  • meu código não passa um TRIANGULO ISOSCELES em um que deveria.

Meu código abaixo

#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

int
biggestValue (int a, int b, int c)
{
  if (a > b && b > c)
    {
      return a;
    }
  else if (a < b && b > c)
    {
      return b;
    }
  else if (a < b && b < c)
    {
      return c;
    }
  else if ((a == b && a > c) || (a == c && a > b))
    {
      return a;
    }
  else if ((b == c && b > a) || (b == a && b > c))
    {
      return b;
    }
  else if (c == a && c == b)
    {
      return a;
    }
}

int
main (int argc, char *argv[])
{
  FILE *fro = fopen ("./input/1045.in", "r");
  FILE *fwr = fopen ("./output/1045.out", "w+");

  double side_a, side_b, side_c, arrangementMule;
  while (fscanf (fro, "%lf %lf %lf", &side_a, &side_b, &side_c) != EOF)
    {
      // Arrange them in decreasing order, so side_a is the biggest.
      if (side_a <= side_b || side_a <= side_c)
        {
          if (side_b < side_c)
            {
              while (side_b < side_c)
                {
                  arrangementMule = side_b;
                  side_b = biggestValue (side_a, side_b, side_c);
                  side_c = arrangementMule;
                }
            }
          arrangementMule = side_a;
          side_a = biggestValue (side_a, side_b, side_c);
          side_b = arrangementMule;
          if (side_b < side_c)
            {
              arrangementMule = side_b;
              side_b = side_c;
              side_c = arrangementMule;
            }
        }
      if (side_a >= (side_b + side_c))
        {
          fprintf (fwr, "NAO FORMA TRIANGULO\n");
        }
      else
        {

          if (pow (side_a, 2) == (pow (side_b, 2) + pow (side_c, 2)))
            {
              fprintf (fwr, "TRIANGULO RETANGULO\n");
            }
          else if (side_a * side_a > side_b * side_b + side_c * side_c)
            {
              fprintf (fwr, "TRIANGULO OBTUSANGULO\n");
            }
          else if (pow (side_a, 2) < (pow (side_b, 2) + pow (side_c, 2)))
            {
              fprintf (fwr, "TRIANGULO ACUTANGULO\n");
            }
          if (side_a == side_b && side_a == side_c)
            {
              fprintf (fwr, "TRIANGULO EQUILATERO\n");
            }
          else if ((side_a == side_b && side_a != side_c)
                   || (side_b == side_c && side_b != side_a)
                   || (side_a == side_c && side_a != side_b))
            {
              fprintf (fwr, "TRIANGULO ISOSCELES\n");
            }
        }
    }
  return EXIT_SUCCESS;
}

Comparei com diversos outros códigos e repositórios na internet, atestando que meu código está similar (em questões lógicas), fiz debug verificando diversos tipos de input, em todos o meu código resolve a ordem A>B>C conforme o exercício pede, e, por fim, resolvi postar aqui (tendo em vista que o Fórum da própria Beecrowd não está permitindo que eu poste por "erro interno"), pois seu repositório foi atualizado recentemente (10h atrás, no momento desta issue)

Agradeço se puder me auxiliar 🙏🏻


Obs: Eu testo tudo com um arquivo "input" e na hora de jogar o código na plataforma, eu mudo os fprintf e fscanf para printf e scanf respectivamente.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.