Submit | All submissions | Best solutions | Back to list |
ITERA - The Iteration |
Given a code as follows:
int main() { int i, j, n, m, nc, count; scanf("%d", &nc); while (nc--) { scanf("%d %d", &n, &m); count = 0; for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { count++; } } printf("%d\n", count); } return 0; }
You have to find how many times will the code run for given values of n and m.
Input
Input starts with an integer T (≤ 1000), denoting the number of test cases.
Each case contains two integers n (1 <= n <= 10000) and m (1 <= m <= 10000).
Output
For each case, print the number denoting how many times will the above code run.
The output will fit in a 32-bit integer.
Example
Input: 1 2 1 Output: Case 1: 2
Added by: | Md. Khirul Islam |
Date: | 2013-06-15 |
Time limit: | 1s |
Source limit: | 20000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ASM32-GCC MAWK BC C-CLANG C NCSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET |
hide comments
2023-03-17 21:27:50 Simes
How many times the code will run? It will run once. or are we supposed to output the final values of Count? But what is the value for NC? How on earth do people get AC with such a poorly worded problem? |
|
2018-07-06 09:21:28
There is no input. Admins, please hide the problem. |
|
2013-06-15 19:04:58 Robert Gerbicz
Actually the c compiler gives multiple errors for the above code. |
|
2013-06-15 19:04:51 Francky
This is a tutorial problem, and it's not very well formated. Moved. |
|
2013-06-15 19:04:50 ওয়াসী (Wasi)
Can't get why SIGXFSZ?? when there is atmost 1000 cases to print Last edit: 2013-06-28 09:43:41 |
|
2013-06-15 18:14:13 shiva_hellgeek
tutorial problem... |