![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
牛客
小兔崽崽!
我还年轻!!!
展开
-
2020江西省大学生程序设计竞赛
这里写目录标题B AppleG Mathematical PracticeI Simple Math ProblemM Zoos's Animal CodesB Apple思路:题目要求每个人的数量不一样,那么就假设给第一个人一个,后面每个人加一,看所需要的苹果是否大于n。#include <bits/stdc++.h>using namespace std;int main(){ int t; cin>>t; while(t--){原创 2020-11-17 19:38:47 · 908 阅读 · 3 评论 -
爵士 (模拟) 水题
思路:这个真就是一个水题=-=#include <bits/stdc++.h>using namespace std;int main(){ int t; cin>>t; while(t--){ double count1 = 0; int n; cin>>n; getchar(); for(int i=0;i<n;i++){ string s; getline(..原创 2020-08-24 19:47:43 · 110 阅读 · 0 评论 -
B-Classical String Problem(牛客多校第三场)思维
思路:直接把这个字符串当做环来看,先定义起始位置sx,每次操作也就是sx = (sx+len1+x)%(len1);这道题要注意的就是数据范围给的比较大,卡时间卡了我好几次,用的是c++的输入输出,一定要记住关闭c的输入输出。ios::sync_with_stdio(false);#include <bits/stdc++.h>using namespace std;int main(){ ios::sync_with_stdio(false); string s;..原创 2020-08-07 17:07:35 · 135 阅读 · 1 评论 -
A-Clam and Fish(牛客多校第三场) 贪心
对于这题我们直接用贪心去做就行,如果是情况2或者情况3,就直接抓鱼,对于情况1,我们就直接做诱饵,如果情况0,那就判断有没有诱饵,有诱饵就抓鱼同时诱饵数减少1至于最后为啥要cnt+=x/2;那是为了判断前面有没有遇到多次多余情况2 ,一次做诱饵,一次抓鱼,这样就可以使得抓的鱼最多。#include <bits/stdc++.h>using namespace std;int main(){ int t;cin>>t; while(t--){ .原创 2020-08-07 15:08:02 · 107 阅读 · 0 评论 -
J - Easy Integration (牛客多校第一场)数论
首先要将这个积分公式化简,用分部积分法不断的去积分逆元的定义:对于a和p,若a*b%p≡1,则称b为a%p的逆元。在求逆元的时候要用到费马小定理:费马小定理:假如p是质数,且gcd(a,p)=1,那么 a^(p-1)≡1(mod p)。即:假如a是整数,p是质数,且a,p互质(即两者只有一个公约数1),那么a的(p-1)次方除以p的余数恒等于1。所以说我们要求的逆元也就是a^(p-2);因为题目中的p特别大,所以就要用到快速幂。int quick_power(int x,int y){ .原创 2020-08-07 09:17:16 · 205 阅读 · 1 评论 -
拯救单身狗
直接判断里面的每个元素出现次数是不是偶数就行,如果是奇数就输出NO。#include <bits/stdc++.h>using namespace std;int t, x,flag;int main(){ cin>>t; for(int i=0; i<t; i++) { map<int,int>mp; set<int>s; while(cin>>x&.原创 2020-08-04 14:46:30 · 88 阅读 · 0 评论 -
购物(优先队列,DP)
思路:这道题可以用DP写也可以用优先队列写,我用的是优先队列,首先就是将每一天的价格sort排序,至于格外要支付k*k的费用只需要将数组处理一下就好,a[i][j] = a[i][j]+2*j+1;然后按天数把当天的所以糖果的价格放入优先队列,再将最先出队的买了,这样就可以保证费用少。#include <bits/stdc++.h>using namespace std;int a[310][310];priority_queue<int,vector<int>,.原创 2020-08-04 14:43:53 · 116 阅读 · 0 评论 -
K小数查询
链接:https://ac.nowcoder.com/acm/contest/3979/I来源:牛客网题目描述热爱学习刻苦奋斗的九条可怜最近做了很多数据结构题,接触到了 K 小数查询这一系列的问题以及线段树的重磅打击这一套理论,她觉得这两样东西都很厉害,所以想要出一道题。给出一个长度为 {n}n 的数列 {A}A,接下来有 {m}m 次操作,操作有两种:1\ l\ r\ x1 l r x...原创 2020-01-23 00:13:27 · 316 阅读 · 0 评论 -
密码学(模拟)
链接:https://ac.nowcoder.com/acm/contest/3979/B来源:牛客网题目描述考虑一种加密方式,它需要一个任意长度的原文 {m}m 和秘钥 {key}key,其中要求原文和秘钥只包含大写和小写的英文字符。首先定义字符之间的加密,用字符 {a}a 去加密字符 {b}b 的结果是:首先把 {a}a 和 {b}b 转成数字 {x}x 和 {y}y。转换的规则是,...原创 2020-01-22 23:35:52 · 480 阅读 · 0 评论 -
HPU's birthday
题目描述2019.10.20 is the 110th birthday of HPU. On that day, you can see the string “110” everywhere.Hery is given an integer n in decimal, he can transform n to a binary string S. For example: (6)_{10...原创 2020-01-20 12:49:11 · 158 阅读 · 0 评论 -
小小小马(思维,dfs搜索)
链接:https://ac.nowcoder.com/acm/problem/200203来源:牛客网给定一个棋盘,已知棋盘的行数和列数是 n,mn,m,每个整数坐标处都有一个糖果,KevenKeven 初始在棋盘的左下角 (1,1)(1,1) 出发,并且 KevenKeven 每次只能跳 ”日” 字,假设 KevenKeven 可以跳无数次,但不可以跳出棋盘,现在 KevenKeven 想知...原创 2020-01-19 17:18:23 · 207 阅读 · 0 评论 -
Binbin's treasure map
链接:https://ac.nowcoder.com/acm/contest/3674/C来源:牛客网题目描述Binbin is a clever boy who likes to wear a skirt. One day, he saw some beautiful skirts on Taobao, but he had not enough money, which made him...原创 2020-01-12 15:47:09 · 367 阅读 · 0 评论 -
The GCD of Fibonacci Numbers
链接:https://ac.nowcoder.com/acm/contest/3674/A来源:牛客网题目描述The Fibonacci sequence is the sequence of numbers such that every element is equal to the sum of the two previous elements, except for the fir...原创 2020-01-12 12:55:20 · 66 阅读 · 0 评论