السابق التالي
0 / 21
الوحدة النمطية DEMO-32-109DEMO-C-32

Rotate 90

DEMO-C-32 • Programming in C

Browser-only practice

بيان المشكلة

Write a program to rotate a square matrix 90 degrees clockwise.

قيود

1 <= N, M <= 10. Integers within standard range.

تنسيق الإدخال

Input: Dimensions N M followed by the matrix elements.

تنسيق الإخراج

Output: The formatted result as specified.

حالات اختبار نموذجية

Submit runs every public testcase in this browser. Results and code never leave this device.

العينة رقم 1
عينة ظاهرة
4 3
2 16 28
20 27 17
17 28 29
21 -5 21
21 17 20 2
-5 28 27 16
21 29 17 28
Rotated 90 degrees clockwise.
العينة رقم 2
عينة ظاهرة
3 3
-4 18 21
11 34 23
22 12 21
22 11 -4
12 34 18
21 23 21
Rotated 90 degrees clockwise.
العينة رقم 3
عينة ظاهرة
2 2
16 1
31 -3
31 16
-3 1
Rotated 90 degrees clockwise.
العينة رقم 4
عينة ظاهرة
5 4
16 7 36 37
20 -3 26 48
29 49 46 7
28 26 14 43
19 29 49 43
19 28 29 20 16
29 26 49 -3 7
49 14 46 26 36
43 43 7 48 37
Rotated 90 degrees clockwise.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
إعدادات المحرر