九度oj 数位拆解 1064
来源:互联网 发布:软件测试看什么书 编辑:程序博客网 时间:2024/06/01 09:44
1064题目:
http://ac.jobdu.com/problem.php?pid=1064
#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>#include <math.h>#include <stack>#include <queue>#define ISYEAP(x) x%100!=0 && x%4==0 || x%400==0 ? 1:0 using namespace std;int n,n9;int main(){ int flag=0; for(int n=1000;n<10000;n++){ n9=n*9; if(n9>=10000) break; if(n9%10!=n/1000) continue; if((n9%100/10)!=(n/100)%10) continue; if((n9/100)%10!=(n%100)/10) continue; if((n9/1000)!=n%10) continue; if(flag==0) { cout<<n; flag++; } else{ cout<<' '<<n; } } cout<<endl;} /************************************************************** Problem: 1064 User: zhouyudut Language: C++ Result: Accepted Time:0 ms Memory:1516 kb****************************************************************/其实可以直接输出1089~
1074题目:
http://ac.jobdu.com/problem.php?pid=1074
#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>#include <math.h>#include <stack>#include <queue>#define ISYEAP(x) x%100!=0 && x%4==0 || x%400==0 ? 1:0 using namespace std;int main(){ int len; int arr[10]; int ii; for(int i=0;i<256;i++) { ii=i*i; len=0; // cout<<i<<' '; while(1){ arr[len]=ii%10; // cout<<arr[len]<<' '; len++; if(ii<10) break; ii=ii/10; } // cout<<endl; int flag=0; for(int j=0;j<=len/2;j++){ if(arr[j]!=arr[len-1-j]){ flag=1; break; } } if(flag==0) cout<<i<<endl; }} /************************************************************** Problem: 1074 User: zhouyudut Language: C++ Result: Accepted Time:0 ms Memory:1516 kb****************************************************************/1124题目:
http://ac.jobdu.com/problem.php?pid=1124
#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>#include <math.h>#include <stack>#include <queue>#define ISYEAP(x) x%100!=0 && x%4==0 || x%400==0 ? 1:0 using namespace std;int main(){ char s[1000]; long long int n; while(1){ cin>>s; int len=strlen(s); n=0; for(int i=0;i<len;i++) n+=s[i]-'0'; if(n==0) return 0; long long int answer=0; while(1){ if(n==0 && answer<10) break; if(n==0 && answer>=10) { n=answer; answer=0; } answer+=n%10; n/=10; } cout<<answer<<endl; } } /************************************************************** Problem: 1124 User: zhouyudut Language: C++ Result: Accepted Time:20 ms Memory:1520 kb****************************************************************/
0 0
- 九度oj 数位拆解 1064
- 九度OJ 1124 Digital Roots -- 数位拆解
- 题目1064:反序数【数位拆解】
- 九度oj 1064
- 数位拆解 1
- 数位拆解 2
- 数位拆解 3
- 数位拆解 4
- (数论)数位拆解---特殊乘法
- 【九度OJ】:九度OJ 1050
- 【九度OJ】:九度OJ 1053
- 【九度OJ】:九度OJ 1056
- 【九度OJ】:九度OJ 1059
- 【九度OJ】:九度OJ 1206
- 九度OJ 1064: 反序数
- 九度OJ题目1064:反序数
- 九度OJ 题目1064:反序数
- 九度 OJ 1064:反序数
- Java获取当前年月日、时间
- Jframe框架基本结构和继承关系
- 数据结构与算法——二分查找(C语言)
- linux grep命令详解
- 对三层的四个问题
- 九度oj 数位拆解 1064
- 在web中实现邮件发送功能
- Atom编辑器入门到精通(三) 文本编辑基础
- VMware vSphere搭建云计算基础架构
- 高效空间索引技术
- ActiveMQ could not be locked错误
- 前端之新闻切换卡
- 微信公众平台开发(104) 自定义菜单扫一扫、发图片、发地理位置
- 编写安卓程序搜索周围的wifi并实现正在连接的wifi的强度