随笔分类 - ACM_刷题
摘要:Fliptile Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 19730 Accepted: 7118 Description Farmer John knows that an intellectually satisfie
阅读全文
摘要:Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a numb
阅读全文
摘要:You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock.
阅读全文
摘要:在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将
阅读全文
摘要:C. K-Dominant Character time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output C. K-Dominant Ch
阅读全文
摘要:B. Two Cakestime limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standard outputIt's New Year's Eve soon, so Ivan
阅读全文
摘要:You are given an array d1,d2,…,dnd1,d2,…,dn consisting of nn integer numbers. Your task is to split this array into three parts (some of which may be
阅读全文
摘要://题意:一个的工作时间是m分钟。 // 在特定的时间和咖啡 n a1,a2....an,, ai代表的是每个咖啡要在一天中对应的时间点喝掉 // 每一次喝咖啡的时间为1分钟 // 必须在一天中的ai时刻喝掉对应的咖啡 // 在两次喝咖啡中间要有d分钟休息时间,天与天之间时间大于d // 尽可能少的天数内将所有咖啡喝完,不只有一种...
阅读全文
摘要:题意: 给一个测试次数 t 每行输入一个数,输入t行d 0<=t<=3000, 0<=d<=3000 使|(a+b)−a⋅b|≤10−6 and |(a+b)−d|≤10−6 注意:精度用1e-7 及可AC
阅读全文
摘要://时间限制:10000ms //单点时限:1000ms //内存限制:256MB //描述 //给定N个不同的质数P1, P2, … PN。用它们作为分目可以组成(P1-1) + (P2-1) + … (PN-1)个分数: // //1/P1, 2/P1, 3/P1, …, P1-1/P1, 1/P2, 2/P2, 3/P2, … P2-1/P2, … 1/PN, 2/PN, … PN-1/P...
阅读全文
摘要://意是在一个数组里,寻找一段连续和,使其平均和最大,但是长度不能小于F, //首先可以看出是满足单调性的,但是怎么二分呢, //我们先枚举一个可能的数。 //然后数组里的值全部减去这个值(结果会有正有负), //那么我们就看是否存一段长度大于等于F,且和为正。对于此的判断,可谓经典,见代码。 #include #include #include #include #includ...
阅读全文
摘要://题意:给出农夫在n天中每天的花费,要求把这n天分作m组, //每组的天数必然是连续的,要求分得各组的花费之和应该尽可能地小,最后输出各组花费之和中的最大值。 //思路:看到各组最小和最大的,果断上二分。很好的一道二分穷举的题。 #include #include using namespace std; int a[100005]; int n, m; bool judge(int...
阅读全文
摘要://题意:这是一个分蛋糕的游戏, t个测试数据,输入n, f n代表的是n块蛋糕,蛋糕的高为1, f代表的是f个人朋友,然后输入每份蛋糕的半径 // 将n块蛋糕分成 f+1 份 每一份都是完成的一块蛋糕,但是可以形状不一样,就每个人最大的蛋糕体积 v , //注意 pi 精度不能小于 3.14159265359 #include #include #include #in...
阅读全文
摘要://汉诺塔问题 //输出移动的步骤 #include <stdio.h> //记录步数 int i = 1; //n 第几号盘移动, from 移动塔 to 目标塔 void move(int n, char from,char to){ printf("第%d次移动第%d号盘: %c >%c\n"
阅读全文
摘要:题目描述 给定一个无序数组,包含正数、负数和0,要求从中找出3个数的乘积,使得乘积最大,要求时间复杂度:O(n),空间复杂度:O(1) 输入描述: 无序整数数组A[n] 输出描述: 满足条件的最大乘积 示例1 输入 复制 3 4 1 2 输出 复制 24 #include <cstdio> #inc
阅读全文
浙公网安备 33010602011771号