hdu 2137 circumgyrate the string
来源:互联网 发布:webkey 源码 编辑:程序博客网 时间:2024/06/06 00:51
字符串旋转,有负数,
abcdefg 2
g
f
e
d
c
d
a
#include<stdio.h>#include<string.h>int main(){int i,j,n,m;char s[100];while(scanf("%s%d",s,&n)!=-1){m=strlen(s);n=n%8;n=(8+n)%8;if(n==0)puts(s);else if(n==2){for(i=m-1;i>=0;i--){for(j=0;j<m/2;j++)printf(" ");printf("%c\n",s[i]);}}else if(n==4){for(i=m-1;i>=0;i--)printf("%c",s[i]);printf("\n");}else if(n==6){for(i=0;i<m;i++){for(j=0;j<m/2;j++)printf(" ");printf("%c\n",s[i]);}}else if(n==1){for(i=m-1;i>=0;i--){for(j=i-1;j>=0;j--)printf(" ");printf("%c\n",s[i]);}}else if(n==3){for(i=m-1;i>=0;i--){for(j=(m-1)-i;j>0;j--)printf(" ");printf("%c",s[i]);printf("\n");}}else if(n==5){for(i=0;i<m;i++){for(j=(m-1)-i;j>0;j--)printf(" ");printf("%c\n",s[i]);}}else if(n==7){for(i=0;i<m;i++){for(j=0;j<i;j++)printf(" ");printf("%c\n",s[i]);}}}return 0;}
- HDU 2137 - circumgyrate the string
- HDU 2137 circumgyrate the string
- HDU 2137 circumgyrate the string
- HDU 2137 circumgyrate the string
- hdu 2137 circumgyrate the string
- hdu---2137circumgyrate the string
- hdu 2137 circumgyrate the string
- HDU 2137 circumgyrate the string
- hdu 2137 circumgyrate the string
- hdu 2137 circumgyrate the string
- HDU 2137 circumgyrate the string
- HDU—— 2137 circumgyrate the string
- circumgyrate the string 2137
- HDU 2137 circumgyrate the string
- hdu2137 circumgyrate the string
- HDU2137:circumgyrate the string
- circumgyrate the string
- HDU2137 circumgyrate the string
- VS2010 error LNK1123: 转换到 COFF 期间失败
- Framebuffer应用程序编程实例
- USB Core 九
- Android apk如何签名,为什么签名
- web服务器、应用服务器、http服务器区别
- hdu 2137 circumgyrate the string
- ALSA的ioctl - hwdep
- 错误3:对于初始化和赋值的模糊概念
- android图片缩放的2个代码
- Java乔晓松-使用Filter过滤器清除网页缓存
- VMware虚拟机上的文件如何和Windows进行共享
- Express.js 中文入门指引手册
- jQuery EasyUI datagrid 不同列用同一 field 输出时没有 formatter 问题
- OSG::geometry绘图类