hdu 2137 circumgyrate the string
来源:互联网 发布:协同过滤算法详解 编辑:程序博客网 时间:2024/06/06 02:34
之前用cin输入老是WA,后面改成scanf就过了,不知道什么原因!还有一点就是中心位置不改变,有两种旋转方式,顺时针和逆时针!!!
#include<bits/stdc++.h>using namespace std;int main(){ char str[85]; int n,k,len; while(scanf("%s%d",str,&n)!=EOF) { len=strlen(str); k=n%8; if(k==0) printf("%s\n",str); if(k==1||k==-7) { for(int i=0;i<len;i++) { for(int j=0;j<len-1-i;j++) printf(" "); printf("%c\n",str[len-1-i]); } } if(k==2||k==-6) { for(int i=0;i<len;i++) { for(int j=0;j<len/2;j++) printf(" "); printf("%c\n",str[len-1-i]); } } if(k==3||k==-5) { for(int i=0;i<len;i++) { for(int j=0;j<i;j++) printf(" "); printf("%c\n",str[len-1-i]); } } if(k==4||k==-4) { for(int i=len-1;i>=0;i--) printf("%c",str[i]); printf("\n"); } if(k==5||k==-3) { for(int i=0;i<len;i++) { for(int j=0;j<len-1-i;j++) printf(" "); printf("%c\n",str[i]); } } if(k==6||k==-2) { for(int i=0;i<len;i++) { for(int j=0;j<len/2;j++) printf(" "); printf("%c\n",str[i]); } } if(k==7||k==-1) { for(int i=0;i<len;i++) { for(int j=0;j<i;j++) printf(" "); printf("%c\n",str[i]); } } } return 0;}
0 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
- Unity锯齿消除
- ES6 函数参数默认值 default
- Eclipse Java注释模板设置详解
- 解决 安装cocoapods失败,提示 requires Ruby version >=2.2.2
- 通过Google+设置壁纸报错
- hdu 2137 circumgyrate the string
- android开发webview的困惑
- Eclipse中java文件头注释格式设置
- hello world (压测)
- iOS实现视图的映射
- property和constructor-arg的使用
- 关于spinner下拉框手动取消的方法。
- 你真的了解你的手机?—麦克风降噪
- CrackingtheCodeInterview之位操作