顺序表中的数据的循环移动

 #include <iostream>
#include <cstdlib>
using namespace std; int main()
{
int *data, n, x;
cin>>n; data = (int*)malloc(n*sizeof(int)); for (int i = ; i < n; ++i)
{
cin>>data[i];
} cin>>x;
if (x< || x > n)
{
cout<<"error!";
return ;
} for (int i = x; i <n; ++i)
{
cout<<data[i]<<" ";
} for (int i = ; i < x; ++i)
{
cout<<data[i]<<" ";
} return ;
}

注:顺序表本身并没有改变只是在输出顺序上做了点改变

SWUST OJ(1101)的更多相关文章

  1. [Swust OJ 404]--最小代价树(动态规划)

    题目链接:http://acm.swust.edu.cn/problem/code/745255/ Time limit(ms): 1000 Memory limit(kb): 65535   Des ...

  2. [Swust OJ 649]--NBA Finals(dp,后台略(hen)坑)

    题目链接:http://acm.swust.edu.cn/problem/649/ Time limit(ms): 1000 Memory limit(kb): 65535 Consider two ...

  3. SWUST OJ NBA Finals(0649)

    NBA Finals(0649) Time limit(ms): 1000 Memory limit(kb): 65535 Submission: 404 Accepted: 128   Descri ...

  4. [Swust OJ 1023]--Escape(带点其他状态的BFS)

    解题思路:http://acm.swust.edu.cn/problem/1023/ Time limit(ms): 5000 Memory limit(kb): 65535     Descript ...

  5. [Swust OJ 1125]--又见GCD(数论,素数表存贮因子)

    题目链接:http://acm.swust.edu.cn/problem/1125/ Time limit(ms): 1000 Memory limit(kb): 65535   Descriptio ...

  6. [Swust OJ 1126]--神奇的矩阵(BFS,预处理,打表)

    题目链接:http://acm.swust.edu.cn/problem/1126/ Time limit(ms): 1000 Memory limit(kb): 65535 上一周里,患有XX症的哈 ...

  7. [Swust OJ 1026]--Egg pain's hzf

      题目链接:http://acm.swust.edu.cn/problem/1026/     Time limit(ms): 3000 Memory limit(kb): 65535   hzf ...

  8. [Swust OJ 1139]--Coin-row problem

    题目链接:  http://acm.swust.edu.cn/contest/0226/problem/1139/ There is a row of n coins whose values are ...

  9. [Swust OJ 385]--自动写诗

    题目链接:http://acm.swust.edu.cn/problem/0385/ Time limit(ms): 5000 Memory limit(kb): 65535    Descripti ...

随机推荐

  1. Back up and restore information in Firefox profiles

    Click the menu button , click Help and select Troubleshooting Information. The Troubleshooting Infor ...

  2. (转载记录)Active Directory 灾难恢复

    部分适用于Windows Server 2003. 在IT环境中谁也不能保证软硬件永远没有故障:那么就需要我们IT能够未雨绸缪,尽量避免故障发生,如果故障发生了,我们需要把损失降到最小:那么就需要我们 ...

  3. poj 2115 Matrix

    题意: 给出一个矩阵,有两种操作: 1.翻转给定的子矩阵: 2.查询a[i][j]的值. 思路: 树状数组是从小到大更新的. 这个题用二维树状数组可以解决,假设是一维树状数组, 0 0 0 0 0 0 ...

  4. css的扩展技术

    CSS的扩展技术 (在原来的CSS语言的基础上扩展了js,可以在里面写js ) 一.less 定义: @color:red; //定义颜色 @body-color:blue; @div-color:y ...

  5. 练手——用Python写的时间戳转换为北京时间的小工具

    #北京时间需加上8小时bj = 8*3600 def time_stamp(times):    #一天总秒数    nonDaySeconds = 24*3600    leapmonths = [ ...

  6. 基于ROS完成寻迹运动

    安装opencv功能包: $ sudo apt-get install ros-indigo-version-opencv libopencv-dev python-opencv  检测指示线: #! ...

  7. windows杀进程

    netstat -aon|findstr 1099 tasklist|findstr 1008 taskkill /pid 10084 -f

  8. UWP中MarkupExtension的使用

    Xaml作为一种描述语言,在编程中极大地简化了页面开发的繁琐及时间消耗,这得益于它的多种特性:数据绑定.动画.资源文件等等.标记扩展作为其一个特性,在xaml中有不可替代的作用,今天分析下自定义标记扩 ...

  9. linux下的缓存机制及清理buffer/cache/swap的方法梳理 (转)

    一.缓存机制介绍 在Linux系统中,为了提高文件系统性能,内核利用一部分物理内存分配出缓冲区,用于缓存系统操作和数据文件,当内核收到读写的请求时,内核先去缓存区找是否有请求的数据,有就直接返回,如果 ...

  10. linux基础之加密解密、PKI及SSL、创建私有CA

    加密解密基础 1. 对称加密: 加密和解密使用同一个密钥 常见的加密算法有:DES.3DES.AES.Blowfish.Twofish.IDEA.RC6.CAST5 特性: 1. 加密.解密使用同一个 ...