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 1264. Workdays

I have two solutions and neither is correct. Why?
Posted by pimiento 25 Nov 2013 23:19
In Python 3.0:
N = int(input())
M = int(input())
result = N*(M+1)
print(result)
#It produces runtime error


In C:
#include <stdio.h>

int main(void) {
  short int n, k;

  scanf("%4hd%4hd", &n, &k);
  printf("%hd\n", n * (k+1));
  return 0;
}
# It produces wrong answer for test N7
Re: I have two solutions and neither is correct. Why?
Posted by Leonid 26 Nov 2013 10:09
SHORT_MAX, probably, is 32767.
Replace short with long or long long.

Edited by author 26.11.2013 10:16
Re: I have two solutions and neither is correct. Why?
Posted by umid 1 Jan 2018 23:14
 scanf("%4hd%4hd", &n, &k); /// you dont need this

 scanf("%i %i", &n, &k); // like this