随笔分类 - CF
摘要:A. K-divisible Sum 题意:给两个数字n,k,构造一个有n个数的数组使得数组的总和可以整除k,且要使这个数组中的每个数尽可能的小,输出数组中的最大值; 思路:这题分两种情况 一:k<=n ;这种情况也分为两种; 1.是n%k==0,这个时候数组中的数字都为1就可以整除k所以直接输出1
阅读全文
摘要:A:题意:给n个数,可以进行0~无数次合并,得到的数除以x(向上取整);求最大值和最小值; 解析:一次都不合并最大,全部合并最小; #include <bits/stdc++.h> #define int long long #define IOS ios_base::sync_with_stdio
阅读全文
摘要:A. Cubes Sorting 题意:给一个数组,只能相邻两两交换排序,问排序的次数是否超过n(n-1)/2-1,超过则输出no没超过输出yes; 思路:看起来这是一个冒泡排序,但我们知道,冒泡排序最坏的情况的时间复杂度是n*(n-1)/2,刚好比题意中大,所以只有当这个数组严格降序的时候才会不符
阅读全文
摘要:看起来很高大上的题,其实就是判断这一堆数的奇偶是否一致 过于简单没有代码
阅读全文
摘要:题目意思就是经过无数次copy求最长上升子序列 总之就是他这一堆数中不同元素的个数 然后用一个map计数就好了 1 #include <bits/stdc++.h> 2 #define int long long 3 const int maxn=1e5+50; 4 const int INF=0x
阅读全文
摘要:洛谷友好的翻译了一下题目,给一个数求最大公因数和最小公倍数的和为原数 根据CF一般的套路,A题绝对是靠思维 我们知道1和任何数的GCD为1,1和任何数的LCM为任何数 1 cin>>n; 2 cout<<1<<" "<<n-1<<'\n'; 所以输入N输出1和n-1就好了 新get到了一个数论的知识
阅读全文
摘要:A. Phoenix and Balance time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Phoenix has nn co
阅读全文
摘要:A. Ichihime and Triangle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ichihime is the
阅读全文
摘要:F. Kate and imperfection time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Kate has a set S
阅读全文
摘要:恢复内容开始 翻译如下 (我看了半天没明白)然后大佬一眼就看出来了(手动膜拜大佬); 就思路当上面一个数组的某一位和下面一个数组的那一位有不同的时候,上减下如果差小于0就看前面有没有1; 大于0看前面有没有-1; 做法: 用map存第一次出现-1的位置和第一次出现1的位置,然后遍历一遍,看是否可行;
阅读全文
摘要:Little Artem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Young boy Artem tries to pai
阅读全文

浙公网安备 33010602011771号