题目链接:https://pintia.cn/problem-sets/994805260223102976/problems/994805316250615808

 #include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
using namespace std;
int n,m;
int a[];
int b[];
int main()
{
while(cin>>n>>m){
for(int i=;i<n;i++) cin>>a[i];
m%=n;
for(int i=;i<m;i++){
b[i]=a[n-m+i];
//cout<<b[i]<<" ";
}
for(int i=m;i<n;i++){
b[i]=a[i-m];
//cout<<b[i]<<" ";
}
for(int i=;i<n;i++){
if(i==) cout<<b[i];
else cout<<" "<<b[i];
}
cout<<endl;
}
return ;
}

PAT (Basic Level) Practice (中文)1008 数组元素循环右移问题 (20 分)的更多相关文章

  1. PAT (Basic Level) Practise:1008. 数组元素循环右移问题

    [题目连接] 一个数组A中存有N(N>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(M>=0)个位置,即将A中的数据由(A0A1……AN-1)变换为(AN-M …… A ...

  2. PAT Basic 1008 数组元素循环右移问题 (20 分)

    一个数组A中存有N(>)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(≥)个位置,即将A中的数据由(A​0​​A​1​​⋯A​N−1​​)变换为(A​N−M​​⋯A​N−1​​A ...

  3. PTA | 1008 数组元素循环右移问题 (20分)

    一个数组A中存有N(N>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(M>=0)个位置,即将A中的数据由(A0 A1--AN-1)变换为(AN-M -- AN-1 A0 ...

  4. PAT乙级 1008. 数组元素循环右移问题 (20)

    1008. 数组元素循环右移问题 (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 一个数组A中存有N(N>0)个整数,在不允 ...

  5. PAT乙级真题1008. 数组元素循环右移问题 (20)

    原题: 1008. 数组元素循环右移问题 (20) 时间限制400 ms内存限制65536 kB 一个数组A中存有N(N>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(M&g ...

  6. [C++]PAT乙级1008.数组元素循环右移问题 (20/20)

    /* 1008. 数组元素循环右移问题 (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 一个数组A中存有N(N>0)个整数, ...

  7. PAT 乙级 1008 数组元素循环右移问题 (20) C++版

    1008. 数组元素循环右移问题 (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 一个数组A中存有N(N>0)个整数,在不允 ...

  8. PAT 1008 数组元素循环右移问题 (20)(代码)

    1008 数组元素循环右移问题 (20)(20 分) 一个数组A中存有N(N&gt0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(M>=0)个位置,即将A中的数据由(A ...

  9. 【PAT】1008. 数组元素循环右移问题 (20)

    1008. 数组元素循环右移问题 (20) 一个数组A中存有N(N>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(M>=0)个位置,即将A中的数据由(A0A1……AN- ...

  10. PAT-乙级-1008. 数组元素循环右移问题 (20)

    1008. 数组元素循环右移问题 (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 一个数组A中存有N(N>0)个整数,在不允 ...

随机推荐

  1. [LeetCode] Search in a Sorted Array of Unknown Size 在未知大小的有序数组中搜索

    Given an integer array sorted in ascending order, write a function to search target in nums.  If tar ...

  2. js判断设备是否为安卓

    var u = navigator.userAgent; var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > - ...

  3. if-else案例–开关灯

    首先,创建一个html页面,添加一个div盒子,用css设置相应的样式,用js获取盒子的元素,通过点击事件,设置body的背景颜色,用if..else来判断当什么状态设置相应的颜色,(swith... ...

  4. 反射RelectionDemo

    using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...

  5. [POI2002][HAOI2007]反素数(Antiprime)

    题目链接 这道题需要用到整数唯一分解定理以及约数个数的计算公式.这里我就不再阐述了. 公式可以看出,只有指数影响约数个数,那么在唯一分解出的乘式中,指数放置的任何位置都是等价的.(即 23*34*57 ...

  6. CentOS启动docker1.13失败(Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.)

    一.启动失败 1.启动docker [root@localhost ~]# systemctl start docker Job for docker.service failed because t ...

  7. maven打包忽略静态资源解决办法,dispatchServlet拦截静态资源请求的解决办法

    问题: maven 打包时,有的文件打不进去target 解决: 因为maven打包默认打Java文件.在项目中的pom文件中加build标签 <build> <resources& ...

  8. 泡泡一分钟:Cooperative Object Transportation by Multiple Ground and Aerial Vehicles: Modeling and Planning

    张宁 Cooperative Object Transportation by Multiple Ground and Aerial Vehicles: Modeling and Planning 多 ...

  9. 2018-2019-2 网络对抗技术 20165311 Exp2 后门原理与实践

    2018-2019-2 网络对抗技术 20165311 Exp2 后门原理与实践 后门的基本概念 常用后门工具 netcat Win获得Linux Shell Linux获得Win Shell Met ...

  10. Python 学习笔记5 变量-列表

    列表是python常用的一种变量. 是由一些列按照特定顺序排列的元素组成的.你可以创建包含字母表中的所有字母,数字.可以将任何东西都加入到列表中. 通常情况下,列表中都包含多个元素,所以建议变量的名称 ...