
第二期水题
浦柳人
岁月悠悠,衰微只及肌肤;热枕抛却,颓唐必至灵魂。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
牛客小白月赛13----I----小A取石子
链接:https://ac.nowcoder.com/acm/contest/549/I来源:牛客网题目描述小A也听说了取石子这个游戏,也决定和小B一起来玩这个游戏。总共有n堆石子,双方轮流取石子,每次都可以从任意一堆中取走任意数量的石子,但是不可以不取。规定谁先取完所有的石子就获胜。但是小A实在是太想赢了,所以在游戏开始之前,小A有一次机会,可以趁小B不注意的时候选择其中一堆石子拿走其中的...原创 2019-04-12 20:55:32 · 348 阅读 · 0 评论 -
2019 计蒜之道 初赛 第二场——A. 矩阵问题
题目背景910291029102 年 999 月 111 日,百度在 X 市 XX 中学举办了一场 AI 知识小课堂,本场 AI 知识小课堂老师教授了一些矩阵的相关知识,因为矩阵在 AI 人工智能中也有相当的应用。题目描述一个同学 LSQ 在小课堂后对矩阵产生极大的感兴趣,他想到了一个对矩阵求和的问题,但是这个矩阵实在太大了,他算不过来,你能帮帮他吗?这个矩阵长这个样子,其右方和下方是没...原创 2019-05-27 08:22:25 · 213 阅读 · 0 评论 -
G - Dancing Stars on Me
The sky was brushed clean by the wind and the stars were cold in a black sky. What a wonderful night. You observed that, sometimes the stars can form a regular polygon in the sky if we connect them pr...原创 2019-05-21 20:19:51 · 289 阅读 · 0 评论 -
J - Knuth-Morris-Pratt Algorithm
In computer science, the Knuth-Morris-Pratt string searching algorithm (or KMP algorithm) searches for occurrences of a “word” W within a main “text string” S by employing the observation that when a ...原创 2019-05-08 20:28:39 · 191 阅读 · 0 评论 -
A - Marjar Cola
Marjar Cola is on sale now! In order to attract more customers, Edward, the boss of Marjar Company, decides to launch a promotion: If a customer returns x empty cola bottles or y cola bottle caps to t...原创 2019-05-08 19:58:39 · 380 阅读 · 0 评论 -
黑龙江大学程序设计竞赛K--- Maximum Sum of Digits
传送门题目:就是让你把n分成a和b,且a和b位数上的各权值相加要得到最大。。。。。思路:就是先求出n的位数x,然后令a等于x-1位的9,如果n的最高位大于1,则在a的最前面加1,b = n - a;最后求出sum即可。例如:n = 202, 则 a = 199, b = 202-199 = 3,所以,sum = 22;注意:一定要用long long,否则会红的。//#include...原创 2019-04-25 16:57:48 · 280 阅读 · 0 评论 -
黑龙江大学程序设计竞赛-C---- Challenge IQ
传送门:C Challenge IQ1,2,3,4,5,6,,,,,,n,这样排不就两两互质了嘛,答案就是n?!着女朋友也太好了吧!为什么我现在还是单身呢?!纳闷了我。。。‘//#include<bits/stdc++.h>#include<stdio.h>#include<algorithm>#include<iostream>#inc...原创 2019-04-25 14:35:46 · 244 阅读 · 0 评论 -
Color the ball HDU - 1556(前缀和)
N个气球排成一排,从左到右依次编号为1,2,3…N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗?Input每个测试实例第一行为一个整数N,(N <= 100000).接下来的N行,每行包括2个整数a b(1...原创 2019-04-29 09:18:01 · 243 阅读 · 0 评论 -
I - ?(>_o)!
?(>_o)! is a pseudo-object-oriented programming language. It implements the following commands:Command Description? :Check whether the character ‘?’ is in the program’s source code. If ‘?’ does...原创 2019-04-23 20:57:31 · 30985 阅读 · 0 评论 -
F - Almost Sorted Array HDU - 5532
We are all familiar with sorting algorithms: quick sort, merge sort, heap sort, insertion sort, selection sort, bubble sort, etc. But sometimes it is an overkill to use these algorithms for an almost ...原创 2019-05-22 19:48:03 · 233 阅读 · 0 评论 -
“美登杯”上海市高校大学生程序设计邀请赛 (华东理工大学)——D. 小花梨的取石子游戏
题目:这题我wa到想死了,,,崩溃的心都有了。。。。。。。#include<stdio.h>#include<iostream>#include<map>#include<algorithm>#include<cstring>#include<string.h>#include<math.h>u...原创 2019-05-18 19:34:40 · 274 阅读 · 0 评论 -
“美登杯”上海市高校大学生程序设计邀请赛 (华东理工大学)——A. 小花梨的字符串
题目:第一次看懵了,然后发现,区间内所有的子串好像都可以排成这样一排,,,所以,就是让你算该区间的所有子串,一个求和公式。。。。#include<stdio.h>#include<iostream>#include<map>#include<algorithm>#include<cstring>#include<str...原创 2019-05-18 19:39:56 · 199 阅读 · 0 评论 -
阿里巴巴协助征战SARS(简单)
题目链接:阿里巴巴协助征战SARS(简单)目前,SARS 病毒的研究在世界范围内进行,经科学家研究发现,该病毒及其变种的 DNA 的一条单链中,胞嘧啶、腺嘧啶均是成对出现的。这虽然是一个重大发现,但还不是该病毒的最主要特征,因为这个特征实在太弱了。为了进一步搞清楚该病毒的特征,CN 疾病控制中心和阿里巴巴集团合作,用科技的力量和程序的思维来解决这个难题。现阿里巴巴特委派你成为 CN 疾病控制中...原创 2019-06-02 18:55:48 · 550 阅读 · 2 评论 -
费马小定理之(阿里巴巴协助征战SARS(困难)
费马小定理:如果p是一个质数,而整数a不是p的倍数,则有a^(p-1)≡1(mod p)。2与1000000007互质。2 ^ 0 = 2 ^ (p-1) 所以循环节为(p-1-0)=1000000006。2 ^ a%1000000007 = 2 ^ (a%1000000006) %1000000007。给出题目:阿里巴巴协助征战SARS(困难)公式:sum = 2^(n-1) + 4...转载 2019-06-02 19:23:50 · 253 阅读 · 0 评论 -
第十届山东省ACM程序设计竞赛(部分题解)
第十届山东省ACM程序设计竞赛(补题)A:只和日有关系,不用管年;//#include<bits/stdc++.h>#include<stdio.h>#include<iostream>#include<algorithm>#include<stdlib.h>#include<string.h>#inclu...原创 2019-05-15 22:40:20 · 666 阅读 · 0 评论 -
POJ 3737——UmBasketella
题目链接:POJ 3737——UmBasketella题意:给出圆锥体的表面积,求当圆锥体积最大时,圆锥的体积、高和底面半径各位多少(用double)分析:师哥说用三分,然而我不会。。。。那么,让我们一起愉快的推公式吧!...原创 2019-06-04 23:09:00 · 298 阅读 · 0 评论 -
POJ-3685-Matrix
Given a N × N matrix A, whose element in the i-th row and j-th column Aij is an number that equals i2 + 100000 × i + j2 - 100000 × j + i × j, you are to find the M-th smallest element in the matrix.I...转载 2019-06-08 19:32:06 · 448 阅读 · 0 评论 -
SDNU训练赛——E—G—H
题目连接:E:C. Ilya and Matrix题目让我们用递归思路;其实,暴力分就可以了#include<stdio.h>#include<iostream>#include<map>#include<algorithm>#include<cstring>#include<string.h>#include...原创 2019-05-28 23:09:20 · 213 阅读 · 0 评论 -
HDU-5875——Function
传送门:HDU-5875——Function思路:我一开始看到3500ms的时候,就暴力莽。。。。。因为最多可以用两for嘛。。。然后T了之后。。。原来可以先标记最右端比a[l]小的数。。。。。。。。。。因为mod运算你最多能mod的数不会很多。。。//#include<bits/stdc++.h>#include <stdio.h>#include <i...转载 2019-05-23 21:11:08 · 162 阅读 · 0 评论 -
HDU-5874——Friends and Enemies
Problem DescriptionOn an isolated island, lived some dwarves. A king (not a dwarf) ruled the island and the seas nearby, there are abundant cobblestones of varying colors on the island. Every two dwa...转载 2019-05-23 20:50:42 · 315 阅读 · 0 评论 -
B - Conic Section
The conic sections are the nondegenerate curves generated by the intersections of a plane with one or two nappes of a cone. For a plane perpendicular to the axis of the cone, a circle is produced. For...原创 2019-05-02 14:42:46 · 357 阅读 · 0 评论 -
B - 畅通工程 HDU - 1863
省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。Input测试输入包含若干测试用例。每个测试用例的第1行给出评估的道路条数 N、村庄数目M ( < 100 );随后的 N行对应村庄间道路的成本,每行给...原创 2019-04-21 20:20:47 · 152 阅读 · 0 评论 -
黑龙江大学程序设计竞赛B Help Me
传送门说实话,这就是n个数两两相减取绝对值求平方和,但是,为什么要这样子敲呢?!我还不是很明白,,,//#include<bits/stdc++.h>#include<stdio.h>#include<algorithm>#include<iostream>#include<stdlib.h>#include<str...原创 2019-04-25 20:20:23 · 190 阅读 · 0 评论 -
Triple Nim-尼姆博弈变形
DescriptionAlice and Bob are always playing all kinds of Nim games and Alice always goes first. Here is the rule of Nim game:There are some distinct heaps of stones. On each turn, two players should...原创 2019-03-17 21:16:31 · 366 阅读 · 0 评论 -
J - Skip the Class
Finally term begins. luras loves school so much as she could skip the class happily again.(wtf?)Luras will take n lessons in sequence(in another word, to have a chance to skip xDDDD).For every lesso...原创 2019-03-20 23:22:34 · 159 阅读 · 0 评论 -
尼姆博弈之 POJ-2975-Nim
尼姆博弈是一个叫尼姆的人提出来的一个数字游戏,大概是这样的:有三堆各若干个物品,两个人轮流从某一堆取任意多的物品,规定每次至少取一个,多者不限,最后取光者得胜。分析:(摘自百度百科T_T)异或算法: a⊕b = !ab + !ba (其中!a 为 非a)。一、这种情况最有意思,它与二进制有密切关系,我们用(a,b,c)表示某种局势,首先(0,0,0)显然是奇异局势,无论谁面对奇异局势,都必...原创 2019-03-15 19:24:31 · 345 阅读 · 0 评论 -
H - Fxx and string HDU - 5944
Young theoretical computer scientist Fxx get a string which contains lowercase letters only.The string S contains n lowercase letters S1S2…Sn.Now Fxx wants to know how many three tuple (i,j,k) there ...原创 2019-03-10 20:39:29 · 141 阅读 · 0 评论 -
弗洛伊德算法A - Arbitrage POJ - 2240
Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 Britis...原创 2019-03-14 21:14:04 · 276 阅读 · 0 评论 -
H - Primes or Palindromes? CodeForces - 569C
Rikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic number is another matter. It is aesthetically pleasing, and...原创 2019-03-03 22:50:23 · 184 阅读 · 0 评论 -
B - Creating the Contest CodeForces
You are given a problemset consisting of n problems. The difficulty of the i-th problem is ai. It is guaranteed that all difficulties are distinct and are given in the increasing order.You have to a...原创 2019-03-03 20:30:53 · 314 阅读 · 0 评论 -
G - Music CodeForces - 569A
Little Lesha loves listening to music via his smartphone. But the smartphone doesn’t have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk.Unfortunately, inte...原创 2019-03-03 20:20:54 · 206 阅读 · 0 评论 -
居然。。。。B - Number of Containers
For two integers m and k, k is said to be a container of m if k is divisible by m. Given 2 positive integers n and m (m < n), the function f(n, m) is defined to be the number of containers of m whi...原创 2019-03-24 19:01:02 · 270 阅读 · 0 评论 -
B - Birthday Tears CodeChef - IOPC17A
On his birthday Chef got a string S consisting of only lowercase letters as a goodie from the Techkriti Team. Chef likes strings which have only one kind of character in them. For example, he likes th...转载 2019-03-24 20:03:46 · 153 阅读 · 0 评论 -
H - Lotus and Characters
Lotus has n kinds of characters,each kind of characters has a value and a amount.She wants to construct a string using some of these characters.Define the value of a string is:its first character’s va...转载 2019-03-21 19:17:00 · 134 阅读 · 0 评论 -
I - Tree Recovery POJ - 2255
Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes.This is an example of one of her creatio...原创 2019-04-03 20:13:51 · 239 阅读 · 0 评论 -
牛客小白月赛13----D----小A的位运算
链接:https://ac.nowcoder.com/acm/contest/549/D来源:牛客网题目描述位运算是一个非常重要的东西。而小A最近在学习位运算,小A看到了一道很简单的例题,是说从N个数里面选出N-1个数要让它们或起来的值最大,小A想知道这个答案是多少。你可以帮帮他吗?输入描述:第一行一个整数N表示有N个数接下来一行N个数表示A1,A2…AN输出描述:一行输出个结果代表...原创 2019-04-12 20:12:23 · 235 阅读 · 0 评论 -
A - Alien's Organ ZOJ - 3696(泊松分布)
There’s an alien whose name is Marjar. It is an universal solder came from planet Highrich a long time ago.Marjar is a strange alien. It needs to generate new organs(body parts) to fight. The generat...原创 2019-03-27 22:09:47 · 132 阅读 · 0 评论 -
E - Excting Secret Chamber at Mount Rushmore
By now you have probably heard that there is a spectacular stone sculpture featuring four famous U.S. presidents at Mount Rushmore. However, very few people know that this monument contains a secret c...原创 2019-04-01 08:40:49 · 241 阅读 · 0 评论 -
“新智认知”第十七届:F---CSL 的神奇序列
链接:https://ac.nowcoder.com/acm/contest/551/F来源:牛客网其实吧,一开始自己推出了一个公式来的:(嗯?!这么大?!)后来看了题解,原来可以递推?!a[i] = a[i-1] + (2*i-1);好了,知道公式了我们就好办了但是不知道为什么开100W的数组我用cb就爆掉了,但是提交还是可以绿的,?????????//#include<b...原创 2019-03-31 18:42:19 · 332 阅读 · 0 评论 -
恶心的大数:E - Easy Basic remains
Given a base b and two non-negative base b integers p and m, compute p mod m and print the result as a base b integer. p mod m is defined as the smallest non-negative integer k such that p = a*m + k f...原创 2019-03-23 21:12:57 · 220 阅读 · 0 评论