|
|
вернуться в форумI have two solutions and neither is correct. Why? 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? Послано Leonid 26 ноя 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? Послано umid 1 янв 2018 23:14 scanf("%4hd%4hd", &n, &k); /// you dont need this scanf("%i %i", &n, &k); // like this |
|
|