UroS29
PCAXE Member
- Učlanjen(a)
- 25.10.2014.
- Poruka
- 409
- Rezultat reagovanja
- 5
Moja konfiguracija
CPU & cooler:
Intel i5 4460
Motherboard:
Asus Trooper B85
RAM:
Kingston HyperX Fury 1x8Gb 1600MHz
VGA & cooler:
MSI R9 380 Armor edition
Display:
LG M2262DP
HDD:
Kingston HyperX Fury 120gb(sistem) & Western Digital Caviar Green 1TB
Case:
Cooler Master K280
PSU:
Cooler Master Elite Power 500w
Mice & keyboard:
A4Tech Bloody Combo
Internet:
ADSL 50/2
OS & Browser:
Windows 10 x64,Google Chrome
Other:
Samsung Galaxy Grand Prime VE
Pozz ljudi, nasao sam jedan sajt codechef.com i na njemu moze sasvim lepo da se uci programiranje. E sad tu ima neki October Challenge i ja sam krenuo da radim ovaj zadatakhttps://www.codechef.com/OCT16/problems/SEASTONE. Napisao sam kod koji deliminicno radi, pa bih molio nekog ko zna da mi pomogne i kaze zasto puca i sta da popravim.
Evo ga kod:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication4
{
class Program
{
static void Main()
{
int t;
t = Convert.ToInt32(Console.ReadLine());
while (t != 0)
{
string s = Console.ReadLine();
int m = 0;
int n = 0;
n = int.Parse(s.Split(' ')[0]);
m = int.Parse(s.Split(' ')[1]);
int[] energy = new int[n];
for (int i = 0; i < n; i++)
{
energy = int.Parse(Console.ReadLine());
}
Array.Sort(energy);
int E = 0;
if (n > m)
{
for (int i = 0; i < (n - m); i++)
{
E += energy * m;
}
}
else
{
if (m % n != 0)
{
E = energy[0] * (n - 1);
}
}
Console.WriteLine(E);
Console.ReadKey();
t--;
}
}
}
}
Na kraju da napomenem da je ovo c# i da radim u Visual Studio 2015 Community.
Evo ga kod:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication4
{
class Program
{
static void Main()
{
int t;
t = Convert.ToInt32(Console.ReadLine());
while (t != 0)
{
string s = Console.ReadLine();
int m = 0;
int n = 0;
n = int.Parse(s.Split(' ')[0]);
m = int.Parse(s.Split(' ')[1]);
int[] energy = new int[n];
for (int i = 0; i < n; i++)
{
energy = int.Parse(Console.ReadLine());
}
Array.Sort(energy);
int E = 0;
if (n > m)
{
for (int i = 0; i < (n - m); i++)
{
E += energy * m;
}
}
else
{
if (m % n != 0)
{
E = energy[0] * (n - 1);
}
}
Console.WriteLine(E);
Console.ReadKey();
t--;
}
}
}
}
Na kraju da napomenem da je ovo c# i da radim u Visual Studio 2015 Community.