![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
每日一题
文章平均质量分 76
qwe585p
这个作者很懒,什么都没留下…
展开
-
每日一题B 2015-6-1 13:23
今天是6.1儿童节小朋友们节日快乐!!! 关于此题,一开始犯了一个致命的错误, 一开始没在b数组内设置初始化的值。碰到0 就b[i] = 0,b[j] = 0. 碰到3 就b[i] = 1,b[j] = 1,碰到1 就b[i] = 1,b[j] = 0,碰到2 就b[i] = 0,b[j] = 1(1代表撞翻,0代表未撞翻),结果导致 WA。什么原因你们懂得。 后来就都设为0,原创 2015-06-01 13:21:56 · 386 阅读 · 0 评论 -
CodeForces 515C. Drazil and Fa
想了一段时间,最后从纯数学的角度上解决的。 首先读入这个串,因为素数是不可以被分解的,所以只要是素数,就整个的保留下来,如果是合数就分解成素数。 4!被分解为3!*2!*2! 6! = 5! * 3! 8! = 7! * 2! * 2! * 2! 9! = 7! * 3! * 3! * 2! 最后再用sort()反向排一下序,输出即可,碰到0和1跳过不管即可。 Descr原创 2015-06-10 11:51:09 · 546 阅读 · 0 评论 -
Codeforces Round #293 (Div. 2)--A-- Vitaly and Strings - Painting
小水,WA了几次,其实不用想太多,因为str1的字典序题目中说肯定比str2的小,所以只要让str1的字典序加上1即可,所以要倒着循环,如果最后是z就要考虑进位的因素。最后在比较一下,str1 != str2 就输出就行了!!! Description Vitaly is a diligent student who never missed a lesson in his f原创 2015-06-10 11:28:35 · 616 阅读 · 0 评论 -
Codeforces Round #292 (Div. 2) -- A. Drazil and Date
大水,因为一定是从(0,0)到(a,b)最短距离就是sum = |a|+|b| 因为a,b 可能为负,所以加绝对值在终点来个滑步就是sum+2,再来一个再+2,所以只要是s > a + b,(s-sum)% 2 !=0 就到不了,s = a + b正好到 s Description Someday, Drazil wanted to go on date with Varda原创 2015-06-10 11:39:48 · 350 阅读 · 0 评论 -
Codeforces Round #294 (Div. 2) -- A. A and B and Chess
大水,先区分大小写,分别累加,最后比较一下大小就好了。 Description A and B are preparing themselves for programming contests. To train their logical thinking and solve problems better, A and B decided to play chess.原创 2015-06-10 11:24:42 · 370 阅读 · 0 评论 -
Codeforces Round #295 A. Pangram
大水,先判断大小写,然后记录一下,最后查一下记录结果。完成. Description A word or a sentence in some language is called a pangram if all the characters of the alphabet of this language appear in it at least once. Pangra原创 2015-06-10 11:17:14 · 390 阅读 · 0 评论 -
每日一题E 2015/6/2 21:50
采用插空法,注意特殊数据,1,2,3,4 尤其是3的情况输出应为 3 1 4 2败就败在这里了。其他情况均可以把1放在a[0]内,唯独3不可以。#include #include #include int main() { int n; scanf("%d", &n); int a[5005] = {0}; int b[5005] = {0}; int原创 2015-06-02 20:51:58 · 919 阅读 · 0 评论 -
每日一题G 2015/6/3 16:38
终于终于把这几道小题弄完了,心好累。这个小破题害我花了4个半小时才AC(之间也干别的事了,比如吃饭,看看新闻)这个一开始 我想的是先把门和钥匙分离出来,变成两个数组方便计算,然后当指向第i个门时,遍历整个第i个(包括第i个)前所有的钥匙,如果没找到就cnt++,如果找到了就把代表钥匙的字母变成0,因为题干说一个钥匙只能用一次,后来提交的时候我就想可能会在面对比较大的数据时 运行超时,果真超时了。因原创 2015-06-03 16:36:57 · 899 阅读 · 0 评论 -
每日一题F 2015/6/2 21:30
一开始直接翻译题意,不断地做减法,导致程序超时,然后果断优化算法,把减法 改成了辗转相除法。解决了超时问题。#include #include #include int main() { long long int a; long long int b; scanf("%lld%lld", &a, &b); long long int sum = 0; w原创 2015-06-02 21:30:22 · 417 阅读 · 0 评论 -
每日一题C 2015-6-1 17:09
一开始把num1,和num2 当成int类型读入 每次分离出一位计算,导致了一个隐藏很深的bug。后来改为用字符串读入把字符当成数字运算就成功了#include #include #include int main() { int n; scanf("%d", &n); char num1[1005],num2[1005]; scanf("%s", &num1原创 2015-06-01 16:58:50 · 491 阅读 · 0 评论 -
每日一题A
首先应该先读懂题意,直接按题目要求做即可。 把n > =sum 的情况单列出来即可。 Description A soldier wants to buy w bananas in the shop. He has to pay k dollars for the first banana, 2k dollars for the second one and so on (in other w原创 2015-05-31 11:52:55 · 417 阅读 · 0 评论 -
每日一题D 2015-6-1 17:34
这个题怎么说呢,太简单了,实在没什么好说的!#include #include #include int main() { int n; scanf("%d", &n); char* a[30] = {"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","原创 2015-06-01 17:33:17 · 416 阅读 · 0 评论 -
CodeForces - 514A Chewbaсca and Number
注意一下,前导0,的情况即可,大于5就搞出来,用字符串来搞。 Description Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means原创 2015-06-10 12:52:08 · 453 阅读 · 0 评论