2013
12-29

# Rolling table

After the 32nd ACM/ICPC regional contest, Wiskey is beginning to prepare for CET-6. He has an English words table and read it every morning.
One day, Wiskey’s chum wants to play a joke on him. He rolling the table, and tell Wiskey how many time he rotated. Rotate 90 degrees clockwise or count-clockwise each time.
The table has n*n grids. Your task is tell Wiskey the final status of the table.

Each line will contain two number.
The first is postive integer n (0 < n <= 10).
The seconed is signed 32-bit integer m.
if m is postive, it represent rotate clockwise m times, else it represent rotate count-clockwise -m times.
Following n lines. Every line contain n characters.

Each line will contain two number.
The first is postive integer n (0 < n <= 10).
The seconed is signed 32-bit integer m.
if m is postive, it represent rotate clockwise m times, else it represent rotate count-clockwise -m times.
Following n lines. Every line contain n characters.

3 2
123
456
789
3 -1
123
456
789

987
654
321
369
258
147

2011-12-16 10:51:51

# include <stdio.h>

int n ;
char grid[15][15] ;

int ABS(int n){return n<0?-n:n;}
void r(char a[15][15], char b[15][15])
{
int i, j ;
char c[15][15] ;
for (i = 0 ; i< n ; i++)
{
for (j = 0 ; j < n ; j++)
c[j][n-i-1] = grid[i][j] ;
}

for (i = 0 ; i < n ; i++)
for (b[i][n] = '\0', j = 0 ; j < n ; j++)
b[i][j] = c[i][j] ;
}

int main ()
{
int m, i, j ;
while (~scanf ("%d %d%*c", &n, &m))
{
if (m > 0) m %= 4 ;
else m = (4 - (ABS(m)%4))%4 ;
for(i = 0 ; i < n ; i++)
gets(grid[i]) ;
for (i = 0 ; i < m ; i++)
r(grid, grid) ;
for (i = 0 ; i < n ; i++)
puts (grid[i]) ;
}
return 0 ;
}

1. bottes vernies blanches

I appreciate the efforts you men and women place in to share blogs on such sort of matters, it was certainly useful. Keep Posting!

2. /*
* =====================================================================================
*
* Filename: 1366.cc
*
* Description:
*
* Version: 1.0
* Created: 2014年01月06日 14时52分14秒
* Revision: none
* Compiler: gcc
*
* Author: Wenxian Ni (Hello World~), [email protected]
* Organization: AMS/ICT
*
* =====================================================================================
*/

#include
#include

using namespace std;

int main()
{
stack st;
int n,i,j;
int test;
int a[100001];
int b[100001];
while(cin>>n)
{
for(i=1;i>a[i];
for(i=1;i>b[i];
//st.clear();
while(!st.empty())
st.pop();
i = 1;
j = 1;

while(in)
break;
}
while(!st.empty()&&st.top()==b[j])
{
st.pop();
j++;
}
}
if(st.empty())
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}

3. 有两个重复的话结果是正确的，但解法不够严谨，后面重复的覆盖掉前面的，由于题目数据限制也比较严，所以能提交通过。已更新算法