Ne prolaze mi primeri 4 i 7 i mislim.
kod:C#
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class Duzina_duzi
{
public struct Kordinate
{
public int x;
public int y;
public int z;
}
static double Rastojanje(Kordinate a, Kordinate b)
{
return Math.Sqrt(Math.Pow((a.x - b.x), 2) + Math.Pow((a.y - b.y), 2) + Math.Pow((a.z - b.z), 2));
}
static void Main()
{
//ucitavanje podataka
int n = int.Parse(Console.ReadLine());
HashSet<double> duzine = new HashSet<double>();
//racunanje duzina
for (int i = 0; i < n; i++) {
string[] unos = Console.ReadLine().Split();
Kordinate a = new Kordinate { x = int.Parse(unos[0]), y = int.Parse(unos[1]), z = int.Parse(unos[2]) };
Kordinate b = new Kordinate { x = int.Parse(unos[3]), y = int.Parse(unos[4]), z = int.Parse(unos[5]) };
duzine.Add(Rastojanje(a, b));
}
Console.WriteLine(duzine.Count);
}
}
}
kod C++:
#include
#include <unordered_set>
struct Kordinate {
long x;
long y;
long z;
};
double rastojanje(Kordinate a, Kordinate b)
{
return sqrt(pow((a.x - b.x), 2) + pow((a.y - b.y), 2) + pow((a.z - b.z), 2));
}
int main()
{
int n;
std::cin >> n;
std::unordered_set<double> duzine;
for (int i = 0; i < n; i++) {
Kordinate a, b;
std::cin >> a.x;
std::cin >> a.y;
std::cin >> a.z;
std::cin >> b.x;
std::cin >> b.y;
std::cin >> b.z;
duzine.insert(rastojanje(a, b));
}
std::cout << duzine.size();
}