进入USACO要注册才能看题: http://train.usaco.org/usacogate
题目:【翻译版、是别处的网站】http://www.wzoi.org/usaco/13%5C106.asp
SAMPLE INPUT (file dualpal.in)
3 25
SAMPLE OUTPUT (file dualpal.out)
26
27
28
又一水题
/*
ID: 1006100071
PROG: dualpal
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <set>
//#include <map>
#include <queue>
#include <utility>
#include <iomanip>
#include <stack>
#include <list>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <ctype.h>
using namespace std;
void my_itoa (int n, char *s, int b) //n为0时失效!
{
int k = 0;
while (n)
{
s[k++] = n % b + '0';
n /= b;
}
s[k] = 0;
//cout << s << endl;
}
bool palind (char *s)
{
int i, len;
len = strlen (s);
for (i = 0; i < len / 2; i++)
if (s[i] != s[len-1-i])
return false;
//cout << "yes\n";
return true;
}
bool isok (int n)
{
int i, k = 0;
char s[30];
for (i = 2; i <= 10; i++)
{
my_itoa (n, s, i);
if (palind (s))
k++/*, cout << s << endl*/;
if (k > 1)
return true;
}
return false;
}
int main()
{
/*freopen ("dualpal.in", "r", stdin);
freopen ("dualpal.out", "w", stdout);*/
int i, n, k = 0, s;
scanf ("%d%d", &n, &s);
for (i = s + 1; k < n; i++)
{
if (isok (i))
printf ("%d\n", i), k++;
}
return 0;
}
分享到:
相关推荐
USACO题目Dual Palindromes (dualpal)及代码解析
USACO全部译题,美国题库USACO全部译题,超经典的题目
美国著名题库USACO的经典试题,配上测试数据和pascal的std标程。祝OIers在信息竞赛的道路上能走得远
其中包含了USACO前些年的月赛试题和部分试题的数据,部分试题的详细题解,英文原题目与翻译后的题目,与题解一一对应
USACO 官网第一到 五章 练习题中文语言官方数据 fps格式支持导入所有OJ 1 [1.1] 你的飞碟在这儿 Your Ride Is Here 2 [1.1] 贪婪的送礼者Greedy Gift Givers 3 [1.1] 黑色星期五Friday the Thirteenth 4 [1.1] 坏掉...
usaco 合集,包括英文原题和中文译题,测试数据以及答案,很全啊!usaco 合集usaco 合集usaco 合集usaco 合集
USACO做题代码
这个是USACO题库中选出来的一些题,覆盖了多方面的知识点,利于锻炼C++学者的算法,里面还有部分题解
仅提供usaco 2006 mar 数据,2006其它时间网上很多。美国著名题库USACO的经典试题,祝OIers在信息竞赛的道路上能走得远
USACO月赛的金组题目,从2000-2009 , 全中文翻译。
数据结构机考所参考的USACO网站所有题目的解题思路,资源比较稀有!
pku acm上的一系列usaco题目都可以在这里找到测试数据以及源代码,不过题目的名字和pku上有得有点出入,需要自己去比较一下,2002年
含2001~2017全部比赛赛题测试...2001~2007 数据√ 题面× 标程题解× 2008~2010 数据√ 题面√ 标程题解× 2011~2017 数据√ 题面√ 标程题解√ 其中除2008~2010外其他年份均按照年度、月度、金银铜白金组别整理完全
usaco历年测试数据
USACO题集及答案
USACO的一些题目代码和月赛十年题典,以及部分题解
USACO所有题目的题解 NOCOW整理版
USACO题解及中文译题1.1.1-2.4.5 题目为TXT格式文档,代码为C++语言所编写
usaco 2010-2011 nov news,喜欢usaco的朋友可以看看