ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1820. Ural Steaks

Why this code have WA on test13?
Posted by acm_tester 20 Mar 2011 03:47
Why this code have WA on test13?
Please give me a test when this program fail.

var N,K:longint;
begin
  readln(N,K);
  if k>N then n:=k;
  N:=2*N;
  if N mod K = 0 then writeln(N div K)
                 else writeln(N div K + 1);
end.
Re: Why this code have WA on test13?
Posted by kutenin 20 Mar 2011 10:16
change 'readln' into 'read'
and 'writeln' into 'write'
and you'll get AC
Good luck =D

Edited by author 20.03.2011 10:37
Re: Why this code have WA on test13?
Posted by acm_tester 20 Mar 2011 16:29
Really, I just change readln to read and give AC.

But in the text of problem:
ENG:
The only input line contains the integers n and k separated with a space
RUS:
В единственной строке через пробел записаны целые числа n и k

Why readln is wrong in this input???
Re: Why this code have WA on test13?
Posted by kutenin 20 Mar 2011 19:39
I don't know =D
Re: Why this code have WA on test13?
Posted by Надежда Халтурина 6 Apr 2011 00:14
1820. Уральские бифштексы
Ограничение времени: 0.5 секунды
Ограничение памяти: 64 МБ

#include <iostream>
using namespace std;
void main()
{
int N,K,p;
cin>>N>>K;
if(K>N) N=K;
N=2*N;
if((N%K)==0) cout<<N/K;
else cout<<(N/K)+1;
}