随笔分类 -  数学

摘要:小红很喜欢奇数。现在小红得到了一个正整数 x。小芳能帮他进行恰好一次如下操作: 操作:使得 x 加上自己的一个因子。 小红想知道小芳能不能帮他把 x 变成奇数,请你帮帮他。 //因为数据量不大,可以直接暴力。 void solve() { int n; cin >> n; int ans = n; 阅读全文
posted @ 2025-06-30 00:34 樱花落舞 阅读(22) 评论(0) 推荐(0)
摘要:A B D均比较简单。先说C题 K-Concatenation Maximum Sum Given an integer array arr and an integer k, modify the array by repeating it k times. For example, if arr 阅读全文
posted @ 2019-09-16 00:05 樱花落舞 阅读(298) 评论(0) 推荐(0)
摘要:给出一个有序数组 A,数组中的每个数字都是 独一无二的,找出从数组最左边开始的第 K 个缺失数字。 示例 1: 示例 2: 示例 3: 提示: 没啥好说的。注意超过数组最大值的就不要去遍历了。直接算! 这题的正解应该也是直接算的。。 阅读全文
posted @ 2019-04-21 20:05 樱花落舞 阅读(302) 评论(0) 推荐(0)
摘要:给定一个数字 N,当它满足以下条件的时候返回 true: 把原数字旋转180°以后得到新的数字。 如 0, 1, 6, 8, 9 旋转 180° 以后,得到了新的数字 0, 1, 9, 8, 6 。 2, 3, 4, 5, 7 旋转 180° 后,得到的不是数字。 易混淆数字 (confusing 阅读全文
posted @ 2019-04-21 19:52 樱花落舞 阅读(747) 评论(0) 推荐(0)
摘要:In a list of songs, the i-th song has a duration of time[i] seconds. Return the number of pairs of songs for which their total duration in seconds is 阅读全文
posted @ 2019-03-17 23:22 樱花落舞 阅读(351) 评论(0) 推荐(0)
摘要:链接:https://www.nowcoder.com/acm/contest/115/I来源:牛客网 题目描述 小P和小Q是好朋友,今天他们一起玩一个有趣的游戏。 他们的初始积分都为1,赢的人可以将自己的分数乘以 (K的平方),而输的人也能乘以K。 他们玩的太开心了,以至于忘了自己玩了多久,甚至 阅读全文
posted @ 2018-04-21 23:00 樱花落舞 阅读(308) 评论(0) 推荐(1)
摘要:链接:https://www.nowcoder.com/acm/contest/115/H来源:牛客网 题目描述 晚上,小P喜欢在寝室里一个个静静的学习或者思考,享受自由自在的单身生活。 他总是能从所学的知识散发出奇妙的思维。 今天他想到了一个简单的阶乘问题, 0!= 1 1!= 1 2!= 1 * 阅读全文
posted @ 2018-04-21 22:54 樱花落舞 阅读(268) 评论(0) 推荐(0)
摘要:链接:https://www.nowcoder.com/acm/contest/115/F来源:牛客网 题目描述 对于方程 2018 * x ^ 4 + 21 * x + 5 * x ^ 3 + 5 * x ^ 2 + 14 = Y, 告诉你Y的值,你能找出方程在0~100之间的解吗? 输入描述: 阅读全文
posted @ 2018-04-21 22:47 樱花落舞 阅读(277) 评论(0) 推荐(0)
摘要:链接:https://www.nowcoder.com/acm/contest/115/C来源:牛客网 题目描述 决赛圈还剩下两个人,“伏地魔”XDD和跑毒进圈的FZL,XDD拿着狙击枪AWM瞄准并准备射击奔跑中的FZL。 XDD知道自己只有这一次机会,如果失误了,他就会被大哥FZL空中360度甩狙 阅读全文
posted @ 2018-04-21 22:41 樱花落舞 阅读(342) 评论(0) 推荐(0)
摘要:给定两个 int 类型的数,不用乘法、除法和取模运算,计算他们的商。 输入格式 第一行依次输入被除数和除数,中间以空格间隔开。 输出格式 输出一个整数,表示它们的商。 给定两个 int 类型的数,不用乘法、除法和取模运算,计算他们的商。 输入格式 第一行依次输入被除数和除数,中间以空格间隔开。 输出 阅读全文
posted @ 2017-11-30 13:59 樱花落舞 阅读(515) 评论(0) 推荐(0)
摘要:Problem Description 假设你有一个矩阵,有这样的运算A^(n+1) = A^(n)*A (*代表矩阵乘法)现在已知一个n*n矩阵A,S = A+A^2+A^3+...+A^k,输出S,因为每一个元素太大了,输出的每个元素模10 Input 先输入一个T(T<=10),每组一个n,k 阅读全文
posted @ 2017-11-18 18:29 樱花落舞 阅读(296) 评论(0) 推荐(0)
摘要:题意:看后面也应该知道是什么意思了 解法: 我们设置l,r,符合条件就是l=起始点,r=当前点,不符合l=i+1 学习了一下FASTIO 阅读全文
posted @ 2017-09-19 11:03 樱花落舞 阅读(188) 评论(0) 推荐(0)
摘要:题意:求n个斐波那契数列组合都无法得到的最小数字 解法: 1 我们先暴力的求出前面几个数字 2 然后再暴力的求递推 3 接着矩阵快速幂(没写错吧?) 阅读全文
posted @ 2017-09-19 10:26 樱花落舞 阅读(222) 评论(0) 推荐(0)
摘要:Problem Description Connecting the display screen and signal sources which produce different color signals by cables, then the display screen can show 阅读全文
posted @ 2017-09-19 09:42 樱花落舞 阅读(202) 评论(0) 推荐(0)
摘要:It's that time of the year, Felicity is around the corner and you can see people celebrating all around the Himalayan region. The Himalayan region has 阅读全文
posted @ 2017-09-08 16:10 樱花落舞 阅读(277) 评论(0) 推荐(0)
摘要:Bash has set out on a journey to become the greatest Pokemon master. To get his first Pokemon, he went to Professor Zulu's Lab. Since Bash is Professo 阅读全文
posted @ 2017-09-08 15:56 樱花落舞 阅读(197) 评论(0) 推荐(0)
摘要:Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the c 阅读全文
posted @ 2017-09-08 09:00 樱花落舞 阅读(360) 评论(0) 推荐(0)
摘要:Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them 阅读全文
posted @ 2017-09-07 18:51 樱花落舞 阅读(228) 评论(0) 推荐(0)
摘要:Maxim wants to buy an apartment in a new house at Line Avenue of Metropolis. The house has n apartments that are numbered from 1 to nand are arranged 阅读全文
posted @ 2017-09-07 12:50 樱花落舞 阅读(257) 评论(0) 推荐(0)
摘要:Petya is a big fan of mathematics, especially its part related to fractions. Recently he learned that a fraction is called proper iff its numerator is 阅读全文
posted @ 2017-09-07 11:54 樱花落舞 阅读(318) 评论(0) 推荐(0)