导航

上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页

2013年8月2日

摘要: 点击打开链接最少乘法次数时间限制:1000ms | 内存限制:65535KB难度:3描述给你一个非零整数,让你求这个数的n次方,每次相乘的结果可以在后面使用,求至少需要多少次乘。如24:2*2=22(第一次乘),22*22=24(第二次乘),所以最少共2次;输入第一行m表示有m(1int num[100001];int main(){ int i; num[1]= 0; num[2] = 1; num[3] = 2; for(i = 4; i < 100001; i++) { if(i % 2 ==0) num[i] = num[i/2] + 1; else num[i] = nu... 阅读全文

posted @ 2013-08-02 14:13 勇敢的炮灰 阅读(118) 评论(0) 推荐(0)

摘要: 点击打开链接棋盘覆盖时间限制:3000ms | 内存限制:65535KB难度:3描述在一个2k×2k(1int main(){ int n; scanf("%d" , &n); while(n--) { int m , i; int top = 1; int flag; scanf("%d" , &m); int num[70] ={1}; while(m--) { for(i = top - 1 ; i >= 0 ; i--) { flag = num[i] * 4; num[i] = flag % 10; num[i+ 阅读全文

posted @ 2013-08-02 14:06 勇敢的炮灰 阅读(152) 评论(0) 推荐(1)

摘要: 点击打开链接487-3279Time Limit:2000MSMemory Limit:65536KTotal Submissions:218558Accepted:38099DescriptionBusinesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the University of Waterloo by 阅读全文

posted @ 2013-08-02 00:31 勇敢的炮灰 阅读(94) 评论(0) 推荐(0)

2013年8月1日

摘要: 点击打开链接ExponentiationTime Limit:500MSMemory Limit:10000KTotal Submissions:120472Accepted:29411DescriptionProblems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many computer syst 阅读全文

posted @ 2013-08-01 23:51 勇敢的炮灰 阅读(181) 评论(0) 推荐(0)

2013年7月31日

摘要: 点击打开链接子串和时间限制:5000ms | 内存限制:65535KB难度:3描述给定一整型数列{a1,a2...,an},找出连续非空子串{ax,ax+1,...,ay},使得该子序列的和最大,其中,1 max,说明出现了从起始点到当前位置总和出现了新的最大值,那么max = sum;当循环完所有的数,max里面存的就是我们想要的答案,这里有一个陷阱就是如果所有数都小于0,那么上面的办法就会得出一个结果0,这肯定是错误的,整个过程中还要加一段判断如果输入的数是负数,那么就要拿来和max比较一下,如果比max大,那么就max = 这个负数,这样下来如果全是负数,那么就会留下一个最大的负数,而不 阅读全文

posted @ 2013-07-31 09:33 勇敢的炮灰 阅读(304) 评论(0) 推荐(0)

摘要: 点击打开链接24 Point game时间限制:3000ms | 内存限制:65535KB难度:5描述There is a game which is called 24 Point game.In this game , you will be given some numbers. Your task is to find an expression which have all the given numbers and the value of the expression should be 24 .The expression mustn't have any other 阅读全文

posted @ 2013-07-31 09:07 勇敢的炮灰 阅读(403) 评论(0) 推荐(0)

2013年7月29日

摘要: 点击打开链接一笔画问题时间限制:3000ms | 内存限制:65535KB难度:4描述zyc从小就比较喜欢玩一些小游戏,其中就包括画一笔画,他想请你帮他写一个程序,判断一个图是否能够用一笔画下来。规定,所有的边都只能画一次,不能重复画。输入第一行只有一个正整数N(N#includeint du[1001];bool map[1001][1001], hash[1001];int q, p;int c;void dfs(int x){ int i; for(i = 1; i <= p; i ++) { if(map[x][i] && !hash[i] && 阅读全文

posted @ 2013-07-29 00:16 勇敢的炮灰 阅读(456) 评论(0) 推荐(0)

2013年7月28日

摘要: 点击打开链接布线问题时间限制:1000ms | 内存限制:65535KB难度:4描述南阳理工学院要进行用电线路改造,现在校长要求设计师设计出一种布线方式,该布线方式需要满足以下条件:1、把所有的楼都供上电。2、所用电线花费最少输入第一行是一个整数n表示有n组测试数据。(n#include #include#includeusing namespace std;bool hash[505];int map[505][505];int v, e;int prime(){ bool flag[505]; int path[505],i,j,sum=0; for(i=1;imap[k][j]) ... 阅读全文

posted @ 2013-07-28 23:57 勇敢的炮灰 阅读(203) 评论(0) 推荐(0)

摘要: 点击打开链接回文字符串时间限制:3000ms | 内存限制:65535KB难度:4描述所谓回文字符串,就是一个字符串,从左到右读和从右到左读是完全一样的,比如"aba"。当然,我们给你的问题不会再简单到判断一个字符串是不是回文字符串。现在要求你,给你一个字符串,可在任意位置添加字符,最少再添加几个字符,可以使这个字符串成为回文字符串。输入第一行给出整数N(0#includeint dp[1002][1002];int main(){ int num; char str[1002], str2[1002]; scanf("%d", &num); w 阅读全文

posted @ 2013-07-28 01:10 勇敢的炮灰 阅读(312) 评论(0) 推荐(0)

摘要: 点击打开链接最长公共子序列时间限制:3000ms | 内存限制:65535KB难度:3描述咱们就不拐弯抹角了,如题,需要你做的就是写一个程序,得出最长公共子序列。tip:最长公共子序列也称作最长公共子串(不要求连续),英文缩写为LCS(Longest Common Subsequence)。其定义是,一个序列 S ,如果分别是两个或多个已知序列的子序列,且是所有符合此条件序列中最长的,则 S 称为已知序列的最长公共子序列。输入第一行给出一个整数N(0int array[1001][1001];int main(){ int num , i , j; char str1[1001] , str. 阅读全文

posted @ 2013-07-28 00:54 勇敢的炮灰 阅读(139) 评论(0) 推荐(0)

上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页