Show all threads Hide all threads Show all messages Hide all messages |
Why wrong answer? Is author crazy? Code is all right! В чём неправильный ответ? Автор шизик? Код нормальный, и всё правильно. | Vlad Polukarov | 1820. Ural Steaks | 2 Feb 2021 19:39 | 1 |
|
1820 Ural Steaks Explained - Simply - Accepted Solution - Read it before you start | Manoj Pathak | 1820. Ural Steaks | 13 Nov 2020 14:50 | 3 |
Lets say there are 5 Steaks and capacity of pan is 4. Step 1: Cook first 4 one side for 1 minute. Step 2: Replace 1 one sided cooked steak with completely uncooked (remaining) one and cook for next 1 minute. Step 3: Now the chef has 3 completely cooked and 2 Half cooked. Cook the remaining 2 half cooked for another one minute. so 1 minute at each step, hence 3 minutes total minimal time. However, story doesn't end here :-). Lets take another example Now, Lets say there are 7 Steaks and capacity of pan is 4. Step 1: Cook first 4 one side for 1 minute. Step 2: Replace 3 one sided cooked steak with completely uncooked (remaining) three and cook for next 1 minute. Step 3: Now the chef has 1 completely cooked and 6 Half cooked. Cook 4 steaks from half cooked six for another one minute. Step 4: Last cook final 2 half cooked one for another one minute So total minimum time take is 4 minute. 1 minute at each step. Please keep in mind the scenarios where 0 steaks or steaks less then cooking capacity of pan. Edited by author 08.06.2017 20:19 Edited by author 08.06.2017 20:20 the scenario with n == 0 or k == 0 won't happen as in the statements it says 1 <= n, k <= 1000 |
Не принимает | Skrom | 1820. Ural Steaks | 23 Feb 2019 07:46 | 5 |
import java.io.*; import java.util.*; public class task { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int k = in.nextInt(); int t; if(n>=1 && k<=1000) { if((int) (n * 2.0 / k) == (n * 2.0 / k)) t = (int) (n * 2.0 / k); else t = 1 + (int) (n * 2.0 / k); out.print(t);
} out.flush(); } } Братан эту задачку на 1 вывод решить можно) зачем тебе эти условия Edited by author 29.10.2015 01:41 Я одного не пойму, как можно обжарить 3 бифа с обеих сторон за 3 минуты, если влазит на сковороду всего 2 шт???))) На первой минуте жаришь первые 2шт с одной стороны, на второй их же со второй. На третей минуте последний биф 1 сторона 4я минута 2я сторона 3го бифа!!. В итоге правильный ответ 4 минуты, а не 3 как написано в примерах. Изи. Смотри 1 и 2 это первые и вторые стороны бифов. B это номер бифа. Разделю их точкой первая минута: 1.1 1.2 вторая минута: 2.1 1.3 третья минута: 2.2 2.3 Я тоже также думал, пока не прочитал в дискуссии: http://acm.timus.ru/forum/thread.aspx?id=36182&upd=636324641214598077 1-я минута - Жарится одна сторона двух стейков.(1-я сторона) 2-я минута - Жарится один из первых стейков(2-я сторона) + третий стейк(1-я сторона) 3-я минута - Жарится второй из первых стейков(2-я сторона) + третий стейк(2-я сторона) |
why is my code not accepted? Visual C | Niloy | 1820. Ural Steaks | 6 Aug 2018 21:53 | 2 |
i am doing (n%k)+(n/k) after putting restriction on k(k<=1000) and n(n>=1). but my answer is said to be wrong.please help. Edited by author 30.06.2013 01:11 14%4 +14/4=2+3=5 but ans is 4. every pancake has 2 sides so 13 pancake has 26 sides.pan fry can fry 4 pancakes at one minute one side. so, IF(2*13%4>=1) sum=((2*n)/k)+1; else{ sum=(2*n)/k; } calculate it . |
what is the 30 test | Bekzat | 1820. Ural Steaks | 6 Feb 2018 23:31 | 3 |
|
answer/ответ Java | Vinchester | 1820. Ural Steaks | 4 Apr 2017 19:00 | 1 |
import java.util.Scanner; public class Zadachi { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int x = 2; if(n<=k){ System.out.print(x); }else{
if (n*2 % k == 0){ System.out.print(n*2/k); }else{ System.out.print(n*2/k+1); } }
} } |
C ++ error in test's, but code is correct | polskyLIDER | 1820. Ural Steaks | 5 Mar 2017 13:15 | 1 |
#include "iostream" using namespace std; int main() { int a, b, rz; cin >> a >> b; if (b == 2 && a != 1 || b == 1 && a != 1) { rz = 2 * a / b; } else { if (a % b != 0) { rz = 2 * (a / b + 1); } else { rz = 2 * a / b; } } cout << rz; return 0; } i tested it a lot, pleas help may be i am so silly.... |
WA java8 | Faizulinda | 1820. Ural Steaks | 1 Mar 2017 18:04 | 1 |
public class Pan { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int m = 2*n; if (m%k == 0){ System.out.println(m/k); } else{ System.out.println(m/k+1); } } } why Wrong Answer? |
WA #8 java | mehdi_wm | 1820. Ural Steaks | 23 Jan 2017 20:07 | 4 |
import static java.lang.Math.*; import java.util.*; public class UralSteaks { public static void main(String[] args) { Scanner in=new Scanner(System.in); int n,k; n=in.nextInt(); k=in.nextInt(); int t=(int)ceil(2*(float)n / (float)k); System.out.print(t); }
} help plz! |
34 WA | Vadimzzz | 1820. Ural Steaks | 15 Dec 2016 12:56 | 2 |
34 WA Vadimzzz 15 Dec 2016 12:50 |
Problem 1820 Ural Steaks has been rejudged | Vladimir Yakovlev (USU) | 1820. Ural Steaks | 24 Oct 2016 12:31 | 1 |
New tests have been added to the problem, all accepted solutions have been rejudged. 490 authors have lost their AC. |
Java 1.8 | Riot | 1820. Ural Steaks | 15 Sep 2016 16:32 | 2 |
Компилятор вычисляет все верно, но здесь задача не проходит. Подскажите, знатоки, в чем проблема? import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner in = new Scanner(System.in); double n = in.nextDouble(); double k = in.nextDouble(); if(n>=1&&n<=1000&&k>=1&&k<=1000){ double a = ((n/k)*2); int b = (int)Math.round(a); System.out.println(b); } } } |
Where is error? test 17 | DSamokhina | 1820. Ural Steaks | 29 May 2016 23:59 | 1 |
import java.io.*; import java.util.*; public class t1820 { public static void main(String[] args){ Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int k = in.nextInt(); int rez = 2; if (n>k){ if (n % k == 0) { rez = 2*n; } else{ if (n % k > k / 2) { rez = (n/k+1)*2; } else { rez = (n/k-1)*2+3; } } } out.println(rez); out.flush(); } } |
Test #13 (Java 1.8) | Landsknecht | 1820. Ural Steaks | 7 Mar 2016 13:59 | 2 |
Guys, I have no idea why it doesn't pass this test. Any suggestions? public static int getMinutes(int n, int k) { if (k == 1){ return n * 2; } else if ( k >= n) { return 2; } else if (n > k) { return n - k + 2; } return 0; } |
Wrong set of test | g00d | 1820. Ural Steaks | 22 Nov 2015 20:22 | 1 |
[n ,k] = [int(x) for x in input().split()] if n >= k: ans = 2 * n // k if 2*n%k > 0: ans += 1 print(ans) else: print(2) and [n ,k] = [int(x) for x in input().split()] if n >= k: ans = 2 * n // k if 2*n%k > 1: ans += 1 print(ans) else: print(2) Both is accepted. But second is worng. Need test: 5 3 |
What is in 30 test? | Philipp Lugovoy | 1820. Ural Steaks | 3 Oct 2015 14:49 | 1 |
All ok!) Edited by author 03.10.2015 14:49 Edited by author 03.10.2015 14:49 Edited by author 05.10.2015 18:55 |
wtf WA TEST#8 PLS HELP ANYONE | Akash_Cross | 1820. Ural Steaks | 24 Sep 2015 22:49 | 5 |
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; //URAL STEAKS public class P { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); String line; int ans; line = br.readLine().trim(); String str[]; str = line.split(" "); int N = Integer.parseInt(str[0]); int K = Integer.parseInt(str[1]); if(2*N%K>1){ ans = (2*N/K)+1; }else{ ans = (2*N/K); } out.print(ans); out.flush(); } } При N = 1, K = 2 программа выдаёт 1, а должна 2 по условию задачи. Please give answer in English... if (n<=k) the answer is 2 |
I am getting this error Runtime error (non-zero exit code). please help. | Md. Salahuddin | 1820. Ural Steaks | 29 Aug 2015 13:06 | 1 |
I understand the problem. There is one frying pan! Edited by author 29.08.2015 13:17 Edited by author 29.08.2015 14:14 Edited by author 29.08.2015 14:15 |
Why two equal Java codes give different results? (test #13) | Ivan Avdonin (Vologda ML) | 1820. Ural Steaks | 3 Aug 2015 07:09 | 1 |
First code gives wrong answer test #13. In the next code I changed System.out.print(2*n/k+2*n%k); and used Math.ceil() System.out.print((int)Math.ceil(2*(float)n/(float)k)); The code was accepted. What's wrong? Edited by author 03.08.2015 07:16 Edited by author 03.08.2015 07:17 Edited by author 03.08.2015 07:17 Edited by author 03.08.2015 07:17 Edited by author 03.08.2015 07:18 Edited by author 03.08.2015 07:18 Edited by author 03.08.2015 07:22 |
Help me please. Where is error? В чем ошибка? | timur1108 | 1820. Ural Steaks | 14 Jun 2015 04:44 | 2 |
var n,k,l:real; begin read(n,k); l:=(n*2/k); if trunc(l)=0 then write(2) else if frac(l)=0 then write(l) else write(trunc(l)+1); end. |