循环右移
来源:互联网 发布:飞利浦x830软件 编辑:程序博客网 时间:2024/05/20 11:51
#include<stdio.h>void reverse(int a[],int s,int e){ int i,j,t; for(i=s,j=e;i<j;i++,j--) { t=a[i]; a[i]=a[j]; a[j]=t; }}int main(){ int a[100],n,i,p; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); printf("shift: "); scanf("%d",&p); p=n-p; reverse(a,0,p-1); reverse(a,p,n-1); reverse(a,0,n-1); for(i=0;i<n;i++) printf("%d ",a[i]); printf("\n"); return 0;}
0 0
- 循环右移
- 字符串循环右移
- 数组循环右移
- 字符串循环右移
- 字符串循环右移
- 字符串循环右移
- 字符串循环右移
- 字符串循环右移
- 循环右移算法
- 字符串循环右移
- 字符串循环右移
- 字符串循环右移
- 字符串循环右移
- 字符串循环右移
- 字符串循环右移
- 字符串循环右移
- 字符串循环右移
- 数组循环右移
- UNITY3D shader学习心得<四> 贴图Fiter mode过滤器模式
- The Clocks
- Activiti 基础总结二
- ubuntu 14.04 telnet 服务配置
- 只允许用来代理上网的SSH账号的方法
- 循环右移
- 表单提交单选框
- MongoDB 初识(一)
- iOS中倒计时实现效果
- 使用Button特效 selector+shape
- 安卓通知栏管理详解及分析 NotificationListenerService
- mysql数据库优化
- 几种排序算法总结:
- 设计模式之单例模式