zoj 1073 Round and Round We Go
来源:互联网 发布:string 转 日历 java 编辑:程序博客网 时间:2024/05/20 15:42
// 大数乘法,我是用数组做的,
//刚上去做错误很多,还是做题太少了。
#include<iostream>#include<cstdio>#include<algorithm>using namespace std;int len;bool cmp(int a[], int b[]){ int i; for(i=0; i<len; i++) { if(a[i]!=b[i]) return false; } return true;}int main(){ string s; int i,j; while(cin>>s) { bool flag=true; len=s.length(); int *a=new int[len]; int *sa=new int[len]; int *na=new int[len]; for( i=0; i<len; i++) { a[i]= sa[i]=s[i]-'0'; } sort(sa,sa+len); int c,temp; for( i=2; i<=len; i++) { c=0; for( j=len-1; j>=0; j--) { temp=a[j]*i+c; na[j]=temp%10; c= temp > 9 ? temp/10 : 0; } sort(na,na+len); if(!cmp(na,sa)) {flag =false; break;} } for( i=0; i<len; i++) cout<<a[i]; if(flag) printf(" is cyclic\n"); else printf(" is not cyclic\n"); } return 0;}
- zoj 1073 Round and Round We Go
- ZOJ 1073 Round and Round We Go
- ZOJ 1073 Round and Round We Go
- zoj 1073 Round and Round We Go
- ZOJ Problem Set - 1073 Round and Round We Go()
- ZOJ 1073 Round and Round We Go(高精度乘法)
- ZOJ Problem Set - 1073(Round and Round We Go)
- ZJUOJ 1073 Round and Round We Go
- Round and Round We Go
- Round and Round we go
- Round and Round We Go
- zoj1073 Round and Round We Go
- pku1047 Round and Round We Go
- Round and Round We Go POJ 1047
- poj 1047 Round and Round We Go
- poj 1047 Round and Round We Go
- <poj1047>Round and Round We Go
- POJ 1047 Round and Round We Go
- Activity的生命周期
- hdu1494之dp
- 了解Flex、Flash、AIR、flashBuilder、MXML、ActionScript的关系
- 游戏开发中常用的设计模式
- 键盘回收事件
- zoj 1073 Round and Round We Go
- 机房管理系统逻辑关系
- 个人博文索引
- 你的第一个Windows程序——关闭窗口
- 解决Access连接 accdb 不可识别的数据库格式异常
- 计算几何初步-向量的旋转 Rescue The Princess
- 斜45度地图简介、坐标系转换以及数据碰撞
- 内存详解
- 【中级】C++析构函数抛出异常