USACO Section 1.2 Dual Palindromes
来源:互联网 发布:淘宝运营工作职责 编辑:程序博客网 时间:2024/05/16 08:34
大意略。
/*ID:g0feng1LANG:C++TASK:dualpal*/#include <iostream>#include <fstream>#include <cstdlib>#include <cstdio>#include <string>#include <cstring>#include <cmath>#include <map>#include <algorithm>#include <stack>using namespace std;ofstream fout("dualpal.out");ifstream fin("dualpal.in");const int maxn = 100010;int b[maxn];int n, s;void read_case(){fin>>n>>s;}int check(int *a, int n){for(int i = 0; i < n/2; i++) if(a[i] != a[n-1-i]) return 0;return 1;}int change(int n, int base){int s = n;int len2 = 0;s = n;while(s){int t = s % base;s /= base;b[len2++] = t;}if(check(b, len2)) return 1;return 0;}void solve(){read_case();int tot = 0;for(int i = s+1; ; i++){int ans = 0;for(int j = 2; j <= 10; j++){if(change(i, j)){ans++;if(ans == 2){tot++;fout<<i<<endl;break;}}}if(tot == n) break;}return ;}int main(){solve();return 0;}
- USACO Section 1.2 Dual Palindromes
- USACO Section 1.2 Dual Palindromes
- USACO section 1.2 Dual Palindromes
- USACO Section 1.2 Dual Palindromes
- USACO section 1.2.4 Dual Palindromes
- USACO Section 1.2.5 Dual Palindromes
- Section 1.2 Dual Palindromes
- Section 1.2 Dual Palindromes
- USACO Training Section 1.2 Dual Palindromes 解题报告&AC代码
- USACO 1.2 Dual Palindromes
- USACO 1.2 Dual Palindromes
- USACO 1.2 Dual Palindromes
- USACO 1.2-Dual Palindromes
- USCAO section 1.2 Dual Palindromes
- [题目] Section 1.2 Dual Palindromes
- USCAO Section 1.2 Dual Palindromes
- USACO 1.2.5 Dual Palindromes
- [USACO 1.2.5] Dual Palindromes
- SVN忽略文件
- Python中,用eval强制将字符串转换为字典变量时候出错:NameError: name 'null' is not defined
- 完全非递归方式解决二叉排序树向双向链表的转换(标准注释)
- 使用telnet协议登陆solrais遇到的问题
- 在JSP界面中判断一个按钮现在是否可用的方法
- USACO Section 1.2 Dual Palindromes
- 团购幸存者:团购是个苦生意
- 笔记1
- 【菜鸟学习--1】数组和排序
- C语言的文件操作
- 【已解决】python中字符串的最后一个字符是斜杠会导致出错:SyntaxError: EOL while scanning string literal
- Maven私服: Nexus开源版 安装笔记
- C输入输出总结
- openfire源码导入到eclipse中