上一页 1 ··· 7 8 9 10 11 12 下一页
摘要: 本题的要求很简单,就是求N个数字的和。麻烦的是,这些数字是以有理数分子/分母的形式给出的,你输出的和也必须是有理数的形式。 输入格式: 输入第一行给出一个正整数N(≤100)。随后一行按格式a1/b1 a2/b2 ...给出N个有理数。题目保证所有分子和分母都在长整型范围内。另外,负数的符号一定出现 阅读全文
posted @ 2020-01-29 16:17 hulian425 阅读(1306) 评论(0) 推荐(0) 编辑
摘要: 题目链接 https://pintia.cn/problem-sets/1218774283169423360/problems/1218774532776648715 方法一, 见代码 #include <cstdio> #include <iostream> #include <algorith 阅读全文
posted @ 2020-01-28 22:11 hulian425 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 题目链接 dp[i] 表示“iloveyou”这个字符串中第i个字母已经出现的“有效次数”; 代码 #include<iostream> #include<cmath> using namespace std; const ll mod = 20010905; ll dp[9]; int main( 阅读全文
posted @ 2020-01-28 19:17 hulian425 阅读(114) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cmath> using namespace std; #define MAXN 10 // 顶点个数最大值 struct Arcnode 阅读全文
posted @ 2020-01-28 16:40 hulian425 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 题目链接 https://vjudge.net/problem/51Nod-1413 一个十进制整数被叫做权势二进制,当他的十进制表示的时候只由0或1组成。例如0,1,101,110011都是权势二进制而2,12,900不是。 当给定一个n的时候,计算一下最少要多少个权势二进制相加才能得到n。 题解 阅读全文
posted @ 2020-01-27 22:10 hulian425 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题目链接https://vjudge.net/problem/NBUT-1666 hkhv学长最近对二进制数很感兴趣,喜欢一切0和1组成的数。现在有一个十进制整数n,问你1到n之间有多少个数是只有0和1组成的类似二进制的数,输出他们的个数。 题解:如果某位大于‘1’,就将其后所有的位置为‘’1’‘, 阅读全文
posted @ 2020-01-27 22:04 hulian425 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 题目链接 https://atcoder.jp/contests/abc153/tasks/abc153_f 题意 : 在坐标轴上有一些怪兽,每个怪兽有对应的生命值hi,你可以对他们进行炮击,你的每次炮击可以队该点前后D范围内的怪兽造成A的伤害,问最少要炮击多少次。 我的最初的想法是先排序,扫到最左 阅读全文
posted @ 2020-01-27 15:13 hulian425 阅读(548) 评论(3) 推荐(0) 编辑
摘要: 对于这道题首先要用到离散化的知识,但是离散化并非常规的离散化。 离散化,如下面的例子(题目的样例),因为单位1是一个单位长度,将下面的 1 2 3 4 6 7 8 10 — — — — — — — — 1 2 3 4 5 6 7 8离散化 X[1] = 1; X[2] = 2; X[3] = 3; 阅读全文
posted @ 2020-01-25 22:12 hulian425 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 链接:https://ac.nowcoder.com/acm/contest/4114/E 火山哥和鸡老八在下棋。 这张棋盘是 n×mn\times mn×m的。每一个格子要么是黑色的,要么是白色的。 两个人轮流进行操作。火山哥先手。每一次可以选择一个黑色的格子,以这个格子为右下角,棋盘左上角为左上 阅读全文
posted @ 2020-01-22 15:56 hulian425 阅读(424) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1166 AC代码 #include<iostream> #include<string> #include <algorithm> #include<cstring> #include<cstdio> us 阅读全文
posted @ 2020-01-21 18:46 hulian425 阅读(112) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 下一页