摘要: find the nth digitTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11272 Accepted Submission... 阅读全文
posted @ 2016-06-05 17:09 Lawliet__zmz 阅读(197) 评论(0) 推荐(0)
摘要: 一、概念时间复杂度是总运算次数表达式中受n的变化影响最大的那一项(不含系数)比如:一般总运算次数表达式类似于这样:a*2^n+b*n^3+c*n^2+d*n*lg(n)+e*n+fa ! =0时,时间复杂度就是O(2^n);a=0,b0 =>O(n^3);a,b=0,c0 =>O(n^2)依此类推e... 阅读全文
posted @ 2016-06-03 20:24 Lawliet__zmz 阅读(477) 评论(0) 推荐(0)
摘要: 一开始直接把case++写在输出位置,结果PE,以为是有什么问题,结果是自己在提交框在原来代码上没有覆盖,导致两段代码在一起提交上去,出现两个main函数当然PE了 sum<0有两种情况,当第一个数是小于0,就直接置为0,然后first的备胎tmp会+1,如果sum1是大于零的,但是到下一个数相加后 阅读全文
posted @ 2016-06-02 20:11 Lawliet__zmz 阅读(254) 评论(0) 推荐(0)
摘要: #include #include using namespace std;const int N = 10000;int main(){ int T,len,i,j,cnt; char str[N]; cin>>T; while(T--){ cnt=1... 阅读全文
posted @ 2016-05-30 20:46 Lawliet__zmz 阅读(126) 评论(0) 推荐(0)
摘要: 如图,下面代码#include #include using namespace std;const int N=10005;int p,q,prime[N],ans[N],num=0;int primePrint(){ int i,j; memset(prime,0,sizeof(pr... 阅读全文
posted @ 2016-05-29 21:19 Lawliet__zmz 阅读(149) 评论(0) 推荐(0)
摘要: 最少拦截系统 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 32503 Accepted Submission(s): 12778 Probl 阅读全文
posted @ 2016-05-25 20:36 Lawliet__zmz 阅读(135) 评论(0) 推荐(0)
摘要: Common Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 32838 Accepted Submission(s): 阅读全文
posted @ 2016-05-24 19:26 Lawliet__zmz 阅读(153) 评论(0) 推荐(0)
摘要: 聪明的kk 时间限制:1000 ms | 内存限制:65535 KB 难度:3 阅读全文
posted @ 2016-05-23 20:06 Lawliet__zmz 阅读(164) 评论(0) 推荐(0)
摘要: The Triangle 时间限制:1000 ms | 内存限制:65535 KB 难度:4 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calcula 阅读全文
posted @ 2016-05-21 17:58 Lawliet__zmz 阅读(137) 评论(0) 推荐(0)
摘要: #include using namespace std;int main(){ cout inline const _Ty& (max)(const _Ty& _Left, const _Ty& _Right) { // return larger of _Left and _... 阅读全文
posted @ 2016-05-21 17:57 Lawliet__zmz 阅读(318) 评论(0) 推荐(0)
摘要: 超级台阶时间限制:1000 ms | 内存限制:65535 KB难度:3描述 有一楼梯共m级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第m级,共有多少走法?注:规定从一级到一级有0种走法。输入输入数据首先包含一个整数n(1using namespace std;const int N... 阅读全文
posted @ 2016-05-21 16:22 Lawliet__zmz 阅读(161) 评论(0) 推荐(0)
摘要: #include using namespace std;const int N = 25;int F[25] = {1,1};int Fib(int n){ if(F[n]) return F[n]; return F[n]=Fib(n-1)+Fib(n-2); }int main()... 阅读全文
posted @ 2016-05-21 15:21 Lawliet__zmz 阅读(100) 评论(0) 推荐(0)
摘要: floor(x),有时候也写做Floor(x),其功能是“向下取整”,或者说“向下舍入”,即取不大于x的最大整数(与“四舍五入”不同,下取整是直接去掉小数部分),例如:[1] x=3.14,floor(x)=3y=9.99999,floor(y)=9与floor函数对应的是ceil函数,向上取整,一... 阅读全文
posted @ 2016-05-19 20:14 Lawliet__zmz 阅读(708) 评论(0) 推荐(0)
摘要: 函数名称: pow函数原型: double pow( double x, double y );函数功能: 计算x的y次幂所属文件: 这个例子中计算了8的2次方: double x=8, y=2; double z; z=pow(x,y);在codeblocs打出po... 阅读全文
posted @ 2016-05-19 20:11 Lawliet__zmz 阅读(500) 评论(0) 推荐(0)
摘要: 小数化分数2Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3364 Accepted Submission(s): 1232 Problem D... 阅读全文
posted @ 2016-05-19 17:43 Lawliet__zmz 阅读(150) 评论(0) 推荐(0)
摘要: 找新朋友Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3596 Accepted Submission(s): 1658Problem Desc... 阅读全文
posted @ 2016-05-17 20:38 Lawliet__zmz 阅读(175) 评论(0) 推荐(0)
摘要: 数字N的因子就是所有比N小又能被N整除的所有正整数,如12的因子有1,2,3,4,6.你想知道你的另一半吗? Input输入数据的第一行是一个数字T(1#include using namespace std;#define N 500005int a[N+5];int main(){ int... 阅读全文
posted @ 2016-05-15 09:32 Lawliet__zmz 阅读(185) 评论(0) 推荐(0)
摘要: Max Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 257953 Accepted Submission(s): 61290 Prob 阅读全文
posted @ 2016-05-14 15:49 Lawliet__zmz 阅读(131) 评论(0) 推荐(0)
摘要: #include using namespace std; int main() { int j,i,k,n,m,t; int a[100002]; scanf("%d",&t); for (j=1;j<=t;j++) { ... 阅读全文
posted @ 2016-05-14 15:21 Lawliet__zmz 阅读(161) 评论(0) 推荐(0)
摘要: 1.#include #include #include using namespace std;int main(){ char a[60]; char b[60]; int score; while(scanf("%s",a)!=EOF){ if (!str... 阅读全文
posted @ 2016-05-12 13:17 Lawliet__zmz 阅读(146) 评论(0) 推荐(0)
摘要: #include #include #include using namespace std;int main(){ int T; char s1[1010],s2[1010]; cin>>T; for(int q=1;q=l2) k=l1; else k=l2;... 阅读全文
posted @ 2016-05-11 23:54 Lawliet__zmz 阅读(173) 评论(0) 推荐(0)
摘要: #include #include #include using namespace std;#define N 1000char s1[N];char s2[N];int main(){ int k,i,j; int l1,l2; int a[N]={0}; int b[N]={0}; ... 阅读全文
posted @ 2016-05-11 21:09 Lawliet__zmz 阅读(134) 评论(0) 推荐(0)
摘要: 传送门:http://acm.split.hdu.edu.cn/showproblem.php?pid=2136利用素数打表的筛选法#include #include #include using namespace std;int a[1000000];int main(){ int ans,... 阅读全文
posted @ 2016-05-07 01:04 Lawliet__zmz 阅读(179) 评论(0) 推荐(0)
摘要: 算是一个小技巧的水题吧,关键要画图才能明白注意一定是首尾相连的形状情况,因为有两刀是重合的,以题目4,6为例,所以按照图中的标记全部切割是4+6-2,2是重合的切割标记数量,数学意义上是4,6的最大公约数,这样如果4人,则1+8 2+3 4+5 6+7,如果6人,则1+2 3+4 5+6......... 阅读全文
posted @ 2016-05-05 02:29 Lawliet__zmz 阅读(124) 评论(0) 推荐(0)
摘要: 1、cin 1、cin.get() 2、cin.getline() 3、getline() 4、gets() 5、getchar()1、cin>> 用法1:最基本,也是最常用的用法,输入一个数字:#include using namespace std; main () { in... 阅读全文
posted @ 2016-04-28 11:20 Lawliet__zmz 阅读(119) 评论(0) 推荐(0)