Total members 11895 |It is currently Tue Dec 03, 2024 6:24 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





>>>please help me I need to solve it queckly
this questio..
Rotating Rings
Description:
Any square grid can be viewed as one or more rings, one inside the other. For
example, as shown in figure (a), a 5 ∗ 5 grid is made of three rings, numbered
1,2 and 3 (from outside to inside.) A square grid of size N is said to be
sorted, if it includes the values from 1 to N2 in a row-major order, as shown
in figure (b) for N = 4. We would like to determine if a given square grid can
be sorted by only rotating its rings. For example, the grid in figure (c) can
be sorted by rotating the first ring two places counter-clockwise, and rotating
the second ring one place in the clockwise direction.
Input Format:
Your program will be tested on one or more test cases. The first input line
of a test case is an integer N which is the size of the grid. N input lines will
follow, each line made of N integer values specifying the values in the grid
in a row-major order. Note than 0 < N ≤ 1, 000 and grid values are natural
numbers less than or equal to 1,000,000.
The end of the test cases is identified with a dummy test case with N = 0.
Output Format:
For each test case, output the result on a single line using the following format:
k.result
Where k is the test case number (starting at 1,)  is a single space, and result
is "YES" or "NO" (without the double quotes.)
Sample Input/Output:
input OUTPUT
4 1. YES
9 5 1 2 2. NO
13 7 11 3
14 6 10 4
15 16 12 8
3
1 2 3
5 6 7
8 9 4
0
I hope to understand this question and help me to solve it by write code it in c++ language
thanks>>^_^




Author:
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : I need you to help me to solve this program by c++ language
 Program to solve equations using double linked list     -  
 how to solve that isssue i m nt able to connect cam and code     -  
 solve the complex numbers and do operations on it     -  
 the text file i saved all in one line. How can i solve it?     -  
 use one dimensional array to solve sales commissions     -  
 what is c++ a brief to c++ language!!!     -  
 Window Through C Language     -  
 How do you know when to use the right programming language?     -  
 Which language is required to set up a web application?     -  
 in what language is C++ and Java are written?     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com