/*
这个题暴力了一下找了个规律用欧拉函数快速筛素因数加上规律就过了
给出任意一个数n化成素数幂的乘积的形式最后的结果等于各个素数幂的个数相乘
比如72=8*9=2^3*3^2 F(72)=F(8)*F(9)=10*6=60
而任何一个素数的幂次方的F(n)的结果为
1 2 3 4 5 6 (次方)
2 3 6 10 15 21
3 3 6 10 15...
分类:
其他好文 时间:
2014-12-28 20:52:06
阅读次数:
107
表达式求值
时间限制:3000 ms | 内存限制:65535 KB
难度:4
描述ACM队的mdd想做一个计算器,但是,他要做的不仅仅是一计算一个A+B的计算器,他想实现随便输入一个表达式都能求出它的值的计算器,现在请你帮助他来实现这个计算器吧。
比如输入:“1+2/4=”,程序就输出1.50(结果保留两位小数)
输入第一行输入一个整数n,共有n组测试数...
分类:
其他好文 时间:
2014-12-28 09:16:44
阅读次数:
133
给出一个长度不超过1000的字符串,判断它是不是回文(顺读,逆读均相同)的。
#include
#include
using namespace std;
int huiwen(char *a){
int len = strlen(a);
int i,j=len-1;
for(i=0;i<len/2;i++,j--){
...
分类:
其他好文 时间:
2014-12-27 23:12:46
阅读次数:
442
数单词
时间限制:2000 ms | 内存限制:120000 KB
难度:4
描述
为了能够顺利通过英语四六级考试,现在大家每天早上都会早起读英语。
LYH本来以为自己在6月份的考试中可以通过六级,可是没想到,成绩出来以后,居然没有通过。所以他不得不付出更多的时间来学习英语。
要想通过六级,最基本的要求就是词汇量。为了能够更快的记住一些陌生单词,LYH有时会找一...
分类:
其他好文 时间:
2014-12-26 23:01:32
阅读次数:
193
一、 题目
题目给出一个字符串,求出它是否为回文字符串,其中只有字母和数字是有效字符,其他的字符可以忽略。
例如:"Aman, a plan, a canal: Panama" 是回文字符串.
"race a car" is not a palindrome.不是回文字符串
二、 分析
看到这个题目我首先想到的是使用两个数组将有效字符串保存,其中一个正序一个逆序,然后做比...
分类:
其他好文 时间:
2014-12-26 21:44:07
阅读次数:
152
这道题是个dp,主要考虑两种情况,刚开始我把状态转移方程写成了dp[i] = min(dp[i-1] + a, dp[i + 1] +b); 后来想想当推到dp[i]的时候,那个dp[i + 1]还没有推出来,所以这种方式推导出来不对,后来又看到dp[i] = min(dp[i-2]的所有情况最小值...
分类:
其他好文 时间:
2014-12-26 16:33:37
阅读次数:
153
Substring
时间限制:1000 ms | 内存限制:65535 KB
难度:1
描述
You are given a string input. You are to find the longest substring of input such that the reversal of the substring is also a substrin...
分类:
其他好文 时间:
2014-12-26 14:40:43
阅读次数:
236
给出一个长度不超过1000的字符串,判断它是不是回文(顺读,逆读均相同)的。
#include
#include
using namespace std;
int huiwen(char *a){
int len = strlen(a);
int i,j=len-1;
for(i=0;i<len/2;i++,j--){
if(a[i]!=a[j]){
return...
分类:
其他好文 时间:
2014-12-26 13:04:13
阅读次数:
191
River Crossing
时间限制:1000 ms | 内存限制:65535 KB
难度:4
描述
Afandi is herding N sheep across the expanses of grassland when he finds himself blocked by a river. A single raft is available for transpo...
分类:
其他好文 时间:
2014-12-26 11:13:47
阅读次数:
242
Adjacent Bit Counts
时间限制:1000 ms | 内存限制:65535 KB
难度:4
描述
For a string of n bits x1, x2, x3, …, xn, the adjacent bit count of the string is given by fun(x) = x1*x2 + x2*x3 + x3*x 4 + … + ...
分类:
其他好文 时间:
2014-12-26 11:10:26
阅读次数:
199