B. Split a Number time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output Dima worked all day and wrote down on a long paper strip his favorite number n consisting of l digits. Unfortunately, the stri…
Split a Number time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Dima worked all day and wrote down on a long paper strip his favorite number nn consisting of ll digits. Unfortunately, the s…
题目传送门 /* 题意:b+1,b+2,...,a 所有数的素数个数和 DP+埃氏筛法:dp[i] 记录i的素数个数和,若i是素数,则为1:否则它可以从一个数乘以素数递推过来 最后改为i之前所有素数个数和,那么ans = dp[a] - dp[b]: 详细解释:http://blog.csdn.net/catglory/article/details/45932593 */ #include <cstdio> #include <algorithm> #include <cs…
题目传送门 /* 题意:这题就是求b+1到a的因子个数和. 数学+DP:a[i]保存i的最小因子,dp[i] = dp[i/a[i]] +1;再来一个前缀和 */ /************************************************ Author :Running_Time Created Time :2015-8-1 14:08:34 File Name :B.cpp ************************************************…
嘿嘿嘿,第一篇文章,感觉代码可以缩起来简直不要太爽 打个div2发挥都这么差... 平均一题fail一次,还调不出错,自闭了 又一次跳A开B,又一次B傻逼错误调不出来 罚时上天,E还傻逼了..本来这场应该很前的,最后只苟在rated的人里面50 A. Chunga-Changa 随便做就行了,因为CF似乎不可以print("%d",0);于是WA了一个样例 #include<cstdio> #include<algorithm> #include<iost…
A. Chunga-Changa 题目链接:http://codeforces.com/contest/1181/problem/A 题目 Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik&quo…
https://codeforces.com/contest/1059/problem/E 题意 给出一棵树,每个点都有一个权值,要求你找出最少条链,保证每个点都属于一条链,而且每条链不超过L个点 和 每条链的权值和不超过S 题解 对于儿子来说,父亲节点只有一个,所以没有决策点.可以从下往上处理出,每个节点最远能爬到那个节点(过程就是倍增) 然后从下往上贪 (选择往上走的远的子节点) #include<bits/stdc++.h> #define ll long long #define pb…
https://codeforces.com/contest/1181/problem/E2 想到了划分的方法跟题解一样,但是没理清楚复杂度,很难受. 看了题解觉得很有道理,还是自己太菜了. 然后直接开始写,四个if写的太难受了180+行. ac之后看了红名大佬的代码,简直woc,好短,四个sort我分开写了,但是红名大佬写的很巧妙,借鉴了一下代码长度缩短到110行左右,红名大佬np,特此记录. 使用静态链表,复杂度计算 T(n) = T(a1)+T(a2)+T(a3) ... + O(nlog…
A:签到. #include<bits/stdc++.h> using namespace std; #define ll long long #define inf 1000000010 char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<'0'||c>'9')) c=getchar();return c;} int gcd(int n…
原文链接:传送 #include"algorithm" #include"iostream" #include"cmath" using namespace std; long long x,y,z,ans; int main(){ while(cin>>x>>y>>z){ ans=; ,i=,j=; s=(x+y)/z; cout<<s<<" "; i=x%z; j…