B. Masha and geometric depression 题意 在黑板上写数列,首项是b,公比是q,超过l时就停止不写.给定m个数,遇到后跳过不写.问一共写多少个数,如果无穷个输出inf. 题解 分类讨论要注意b大于l,则一个也不会写.(仔细读题!! 暴力的话,可以用map或者set,然后遇到重复的就是inf. 代码 const int N = 2000001; ll b,q,u,m; ll a[N]; int main(){ while(~scanf("%lld%lld%lld%ll…
Anastasia and pebbles 题意:你有两种框,每个框可以最多装k重量的物品,但是你每个框不能装不一样的物品.现在地面上有n个物品,问你最少多少次,可以把这n个物品全部装回去. 题解:其实就是问你得用多少次框,然后把多少次除以2就好了.每次装k的物品装回去就好了. 代码: #include<bits/stdc++.h> using namespace std; const int maxn = 1e5+7; int a[maxn],n,k; int main(){ scanf(&…
A. Anastasia and pebbles time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Anastasia loves going for a walk in Central Uzhlyandian Park. But she became uninterested in simple walking, so she…
计蒜客)翻硬币 //暴力匹配 #include<cstdio> #include<cstring> #define CLR(a, b) memset((a), (b), sizeof((a))) using namespace std; int n, m, t; int main() { int i, j, x; scanf("%d", &t); while(t--) { scanf("%d%d", &n, &m)…