Блог пользователя BarkovBG

Автор BarkovBG, история, 2 года назад, По-английски

Hi! I have some problems with platform HackerRank. I have received the email from them with suggestion to work on freelance basis. I have made some tasks for them and they have successfully approve them. Then, by agreement, they had to pay for the prepared task, But they just start ignoring me.

This situation doesn't upset me. But I become very angry when they write me after 3 months after this situation again. Just be careful with this platform and don't work with them!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +140
  • Проголосовать: не нравится

Автор BarkovBG, история, 4 года назад, По-русски

Hello! I am trying to solve the problem 1349B - Orac and Medians And the solution from editorial answer "yes" in this test case:

1
7 3 
5 0 5 1 1 1 3

I don't understand why... Can you help me, please?

UPD: Thank you so much. I was answered a question.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

Автор BarkovBG, история, 4 года назад, По-русски

Возникла такая проблема.

Я хочу сдать эту задачу на GO — 1307A - Cow and Haybales

Но при отправке этого кода:

package main;

import (
	"fmt"
)

func min(a, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}

func solve() {
	var n, d int
	fmt.Scanf("%v%v", &n, &d)
	var a = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%v", &a[i])
	}
	for i := 1; i < n; i++ {
		var x int = min(a[i], d / i)
		a[0] += x
		a[i] -= x
		d -= x * i
	}
	fmt.Println(a[0])
}

func main() {
	var n int
	fmt.Scanf("%v", &n)
	for i := 0; i < n; i++ {
		solve()
	}
}

Я получаю RE, так как обращаюсь к 0 элементу, а компилятор считает, что его может не быть.

На кф(codeforces) есть go 1.12.6, а хотелось бы go 1.13.8 (более новый), который нормально работает в этом случае.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится