
ACM--基础
文章平均质量分 69
努力过
喜欢coding
展开
-
zoj 3878 Convert QWERTY to Dvorak 【模拟】
Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY Keyboard with a broken Caps Lock key, so Edward never presses the broken Caps Lock key. Luckily, all the oth...原创 2018-05-16 09:09:27 · 253 阅读 · 0 评论 -
A.挑战密室 河南省第八届ACM 【模拟】
问题 : A.挑战密室时间限制: 1 Sec 内存限制: 128 MB提交: 12 解决: 7[提交][状态]题目描述 R组织的特工Dr. Kong 为了寻找丢失的超体元素,不幸陷入WTO密室。Dr. Kong必须尽快找到解锁密码逃离,否则几分钟之后,WTO密室即将爆炸。 Dr. Kong发现密室的墙上写了许多化学方程式中。化学方程式,也称为化学反应方程式,是用化学式表示物质化学反应的式子...原创 2018-05-11 20:32:37 · 238 阅读 · 0 评论 -
uva 3177 A - Beijing Guards 【贪心+二分】
题意:给定n个数,表示每个人想要的礼物种类,相邻的人礼物种类不能有重复的礼物种类,1和n相邻问,最少需要多少种类的礼物才能满足所有人的要求思路:二分构造。自己只想到了偶数的情况下,最少需要的礼物数是相邻值最大的和奇数情况下,分配策略是,编号为偶数的人,尽量取种类编号靠前的数,编号为奇数的人,尽量取种类编号靠后的数。奇数情况我始终想不出来,而lrj的训练指南说:"不难发现,最优的分配策略是...",...原创 2018-05-03 13:11:35 · 165 阅读 · 0 评论 -
uva 3971 D - Assemble【二分枚举查找】
题意:给定n个配件的类型,名字,价格和品质因子,每种类型的配件各选一个 问在b元的预算下,找到最小品质因子的最大值(最小品质因子指选出的配件都大于该品质因子) 思路:找到所有配件中的最大品质因子,再二分枚举查找最小品质因子在每种类型的配件中查找所有品质因子大于枚举值q的最小价格,计入预算如果预算超出b,说明该枚举值q不满足条件,如果满足预算,则右移继续查找,直到跳出循环 #include<...原创 2018-05-03 12:27:54 · 164 阅读 · 0 评论 -
uva 11384 C - Help is needed for Dexter【规律】
题意:输入n,表示有1~n个数,任意选定一个数number,则可以将所有大于等于该数的所有数减去number,问最小需要多少步能将所有数减为0.思路:找规律。比如n=5.1,2,3,4,5 都减去3以后为{1,2,0,1,2},这时候就相当于求n=2时的最小步数。即f(5) = f(2) + 1.#include<stdio.h>int dfs(int n){ if(n == ...原创 2018-05-02 20:42:24 · 491 阅读 · 0 评论 -
uva 11464 B - Even Parity 【二进制枚举】
题意:给定一个n*n的矩阵,由0 1组成,每次操作可以将0变成1,问,最少需要多少次操作可以使每个数周围数之和为偶数。思路:枚举第一行可能有的所有情况,再根据每种情况计算出剩下行的排列存入临时数组,每次操作之和就是临时数组和原数组不同的值总和,取所有情况之和中的最小值输出即可。#include<stdio.h>#include<string.h>#include<...原创 2018-05-02 17:41:28 · 215 阅读 · 0 评论 -
九度oj 1164 在线判题【模拟】
LittleTom开发了一个在线判题系统,判题系统需要把用户提交上来的代码编译成可执行文件,然后运行。而用户会提交什么样的代码是无法预知的,所以LittleTom做了充分的准备,比如阻止解题程序访问文件系统、阻止解题程序访问注册表、阻止解题程序修改系统设置、阻止解题程序关闭系统、阻止解题程序超限或非法使用内存、阻止解题程序的运行时间超过设定时间等。这些工作LitteTom都已完成。 还有一个待...原创 2018-04-30 19:11:07 · 419 阅读 · 0 评论 -
uva 11300 B - Spreading the Wealth 【数学思维】
题意:输入n,给定n个人的金币数,问平均分金币移动的最少金币数。思路:设平均金币数为sum,则可以列出以下等式sum = a[1] - x1 + x2sum = a[2]- x2 + x3..........sum = a[n]-xn + x1xi是第i个人的得失金币数,正数表示得到的金币数,负数表示失去的金币数根据上述式子可推得:x2 = x1 - (a[1]-sum)x3 = x1 - {(a...原创 2018-04-25 20:48:34 · 200 阅读 · 0 评论 -
uva 11729 A - Commando War 【基础】
题意:给你n个士兵,每行两个整数,交代任务的时间和完成任务的时间,任务可以同时进行完成,输出最小完成全部任务的时间。思路:按完成任务时间从大到小进行排序,每次总的准备时间+当前交代任务的时间和第一个交代任务时间+完成任务时间比较,取较大值。比赛碰到这种水题,少说得半个小时才能想出来。。。#include<stdio.h>#include<algorithm>#inclu...原创 2018-04-24 15:55:00 · 188 阅读 · 0 评论 -
Educational Codeforces Round 39 (Rated for Div. 2)
A. Partitiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a sequence a consisting of n integers. You may partition this sequence in...原创 2018-04-15 19:38:24 · 295 阅读 · 0 评论 -
poj3687 Labeling Balls【反向建图拓扑排序】
DescriptionWindy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 to N in such a way that: No two balls share the same label.The labeling satisfies several con...原创 2018-04-13 20:53:03 · 270 阅读 · 0 评论 -
poj1094 Sorting It All Out 【拓扑排序】
DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequence A,...原创 2018-04-13 13:49:28 · 236 阅读 · 1 评论 -
Codeforces Round #240 (Div. 2)
A. Mashmokh and Lightstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMashmokh works in a factory. At the end of each day he must turn off ...原创 2018-04-06 11:13:25 · 189 阅读 · 0 评论 -
Codeforces Round #239 (Div. 2)
A. Line to Cashiertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Vasya went to the supermarket to get some groceries. He walked about the s...原创 2018-04-03 19:23:57 · 152 阅读 · 0 评论 -
#codeforces #244 (div2)A. Ksenia and Pan Scales【模拟】
Ksenia has ordinary pan scales and several weights of an equal mass. Ksenia has already put some weights on the scales, while other weights are untouched. Ksenia is now wondering whether it is possibl原创 2018-02-04 13:56:28 · 315 阅读 · 0 评论 -
codeforces #233 (Div2) C. Sereja and Prefixes【二分+递归】
C. Sereja and Prefixestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSereja loves number sequences very much. That's原创 2018-02-02 18:50:56 · 226 阅读 · 0 评论 -
codeforces #233 (Div2) A. Sereja and Dima【模拟】+B. Sereja and Stairs【暴力】
A. Sereja and Dimatime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSereja and Dima play a game. The rules of the game原创 2018-02-02 18:08:49 · 1005 阅读 · 0 评论 -
poj 3624 Charm Bracelet 【01背包】+poj2524【并查集】
Bessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from theN (1 ≤ N ≤ 3,402) available charms. Each charm i in the原创 2018-01-26 21:56:37 · 155 阅读 · 0 评论 -
poj 3295 Tautology【构造法】【刷题计划】
TautologyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 13580 Accepted: 5214DescriptionWFF 'N PROOF is a logic game played with dice. Eac原创 2017-12-29 15:46:16 · 751 阅读 · 0 评论 -
poj 1573 Robot Motion 【模拟】【刷题计划】
Robot MotionTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 14641 Accepted: 7032DescriptionA robot has been programmed to follow the i原创 2017-11-22 14:14:45 · 284 阅读 · 0 评论 -
poj 2632 Crashing Robots【模拟】【略坑~】【刷题计划】
Crashing RobotsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11233 Accepted: 4753DescriptionIn a modernized warehouse, robots are used t原创 2017-11-21 18:42:08 · 305 阅读 · 0 评论 -
poj1068 Parencodings【模拟】【刷题计划】
ParencodingsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 27375 Accepted: 16094DescriptionLet S = s1 s2...s2n be a well-formed string of原创 2017-11-18 15:31:21 · 362 阅读 · 0 评论 -
poj 2586 Y2K Accounting Bug【贪心】【刷题计划】
Y2K Accounting BugTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 16154 Accepted: 8111DescriptionAccounting for Computer Machinists (ACM)原创 2017-11-16 17:08:08 · 558 阅读 · 0 评论 -
poj2109 Power of Cryptography【坑~泪目】【水过~】【刷题计划】
Power of CryptographyTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 26249 Accepted: 13121DescriptionCurrent work in cryptography involves原创 2017-11-16 13:20:59 · 391 阅读 · 0 评论 -
poj 1328 Radar Installation【贪心】【刷题计划】
Radar InstallationTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 93433 Accepted: 20855DescriptionAssume the coasting is an infinite strai原创 2017-11-12 20:28:38 · 457 阅读 · 0 评论 -
poj 2965 The Pilots Brothers' refrigerator 【dfs+枚举】【双十一大礼包】【刷题计划】
The Pilots Brothers' refrigeratorTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 27522 Accepted: 10625 Special JudgeDescriptionThe原创 2017-11-11 16:07:10 · 278 阅读 · 0 评论 -
hdu 5532【最长非递增子序列 时间复杂度 nlogn】
Almost Sorted ArrayTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 6044 Accepted Submission(s): 1451Problem DescriptionWe a原创 2017-10-12 11:04:09 · 368 阅读 · 0 评论 -
hdu 5538 House Building 【矩阵表面积】
House BuildingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1808 Accepted Submission(s): 1138Problem DescriptionHave you原创 2017-09-14 16:54:00 · 372 阅读 · 0 评论 -
hdu5914 Triangle 【贪心】
TriangleTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1413 Accepted Submission(s): 840Problem DescriptionMr. Frog has n sti原创 2017-09-13 09:41:31 · 398 阅读 · 1 评论 -
2016中国大学生程序设计竞赛(ccpc 长春) Fraction【模拟】
Problem DescriptionMr. Frog recently studied how to add two fractions up, and he came up with an evil idea to trouble you by asking you to calculate the result of the formula below:As a talent原创 2017-09-12 22:40:07 · 556 阅读 · 0 评论 -
B - Radar Installation poj 1328【贪心】
Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, locating on the原创 2017-09-04 22:28:59 · 317 阅读 · 0 评论 -
51nod 1137矩阵乘法【矩阵】
1137 矩阵乘法基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注给出2个N * N的矩阵M1和M2,输出2个矩阵相乘后的结果。 Input第1行:1个数N,表示矩阵的大小(2 <= N <= 100)第2 - N + 1行,每行N个数,对应M1的1行(0 <= M1[i] <= 1000)原创 2017-09-03 10:22:36 · 252 阅读 · 0 评论 -
NYOJ 2356: 哈希计划【模拟】
题目描述众所周知,LLM的算法之所以菜,就是因为成天打游戏,最近LLM突然想玩《金庸群侠传X》,结果进去后各种被虐,LLM就开始研究这个游戏的代码,顺便还学会了一点点点点lua语言,然后就开始了伟大的改游戏代码之旅,然后LLM发现自己too young了,这个游戏把所有的文本都进行了哈希,如果自己改了代码或者剧情文本的话它哈希出来的值就会和原来的哈希值不一样......然后游戏就会打不开.原创 2017-09-01 22:30:39 · 215 阅读 · 0 评论 -
1008 N的阶乘 mod P【基础题or 水题?】
1008 N的阶乘 mod P基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注输入N和P(P为质数),求N! Mod P = ? (Mod 就是求模 %) 例如:n = 10, P = 11,10! = 36288003628800 % 11 = 10Input两个数N,P,中间用空格隔原创 2017-08-28 16:49:51 · 382 阅读 · 0 评论 -
51nod 1384 全排列 【递归】
1384 全排列基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注给出一个字符串S(可能有重复的字符),按照字典序从小到大,输出S包括的字符组成的所有排列。例如:S = "1312",输出为: 1123113212131231131213212113213123113112原创 2017-08-28 16:10:43 · 233 阅读 · 0 评论 -
codeup5972:全排列 【递归入门】
题目描述 排列与组合是常用的数学方法。 先给一个正整数 ( 1 例如n=3,所有组合,并且按字典序输出: 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1 输入输入一个整数n( 1输出输出所有全排列每个全排列一行,相邻两个数用空格隔开(最后一个数后面没有空格)样例输入原创 2017-08-26 16:56:13 · 518 阅读 · 0 评论 -
【练习赛补题】问题 E: 花生采摘 【模拟】
题目描述 鲁宾逊先生有一只宠物猴,名叫多多。这天,他们两个正沿着乡间小路散步,突然发现路边的告示牌上贴着一张小小的纸条:“欢迎免费品尝我种的花生!——熊字”。 鲁宾逊先生和多多都很开心,因为花生正是他们的最爱。在告示牌背后,路边真的有一块花生田,花生植株整齐地排列成矩形网格(如图1)。有经验的多多一眼就能看出,每棵花生植株下的花生有多少。为了训练多多的算术,鲁宾逊先生说:“你先原创 2017-08-25 09:41:53 · 1329 阅读 · 0 评论 -
练习赛2(AC题)
问题 B: 赌徒题目描述有n个赌徒打算赌一局。规则是:每人下一个赌注,赌注为非负整数,且任意两个赌注都不相同。胜者为赌注恰好是其余任意三个人的赌注之和的那个人。如果有多个胜者,我们取赌注最大的那个为最终胜者。例如,A,B,C,D,E分别下赌注为2、3、5、7、12,最终胜者是E,因为12=2+3+7。输入输入包含多组测试数据。每组首先输入一个整数n(1接下来原创 2017-07-23 16:27:35 · 763 阅读 · 0 评论 -
练习赛1(补题)
问题 E: 一家人题目描述最近zzq交了一个新朋友叫cj,他们在聊天的时候发现500年前他们竟然是一家人!现在zzq想知道cj是他的长辈,晚辈,还是兄弟。输入输入包含多组测试数据。每组首先输入一个整数N(N输入数据保证每个人只有一个父亲。输出对于每组输入,如果cj是zzq的晚辈,则输出“You are my younger”,如果cj是zzq的长辈,则输出“Yo原创 2017-07-22 16:16:26 · 322 阅读 · 0 评论 -
练习赛1(AC题)
问题 A: 构建矩阵题目描述现请你构建一个N*N的矩阵,第i行j列的元素为i与j的乘积。(i,j均从1开始)输入输入的第一行为一个正整数C,表示测试样例的个数。然后是C行测试样例,每行为一个整数N(1输出对于每一组输入,输出构建的矩阵。样例输入214样例输出11 2 3 42 4 6 83 6 9 124 8 12 16#incl原创 2017-07-22 15:35:07 · 1701 阅读 · 0 评论