CodeForces 625D Finals in arithmetic】的更多相关文章

神奇的构造题,我的思路比较奇葩.搞了好久,看到WA on 91我绝望了,然后自己造数据,找到了错误,总算是AC了,现在是凌晨0:24分,看到AC之后,感动China! 我写的代码无比的长.....应该有很简单的方法吧.....没想到. #include <stdio.h> #include <algorithm> #include <string.h> #include <queue> #include <stack> #include <…
D. Finals in arithmetic 题目连接: http://www.codeforces.com/contest/625/problem/D Description Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all th…
传送门 Description Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much…
Codeforces 115 D 题意:给一个没有括号的表达式,问有多少种添加括号的方法使得这是一个合法的表达式?输入可能有正负号.加减乘除.数字. 思路1: 这是不能过的\(naive\)的\(dp\). 考虑\(dp(l,r)\)表示从第\(l\)个字符到第\(r\)个字符有多少种添加括号的方法. 转移的时候就枚举当前最后一次运算. 思路2: 这是\(tourist\)的神奇\(dp\). 考虑\(dp(i,j)\)表示第\(i\)个正负符号到第\(j\)个连续符号段连着的那个数字有多少种添…
题目链接:https://codeforces.com/contest/978/problem/D 题解: 题目的大意就是:这组序列能否组成等差数列?一旦构成等差数列,等差数列的公差必定确定,而且,对于给定的数列,公差的可能性是已知的. 我的解决思路是:对于给定的数列,最后一位数 - 第一位数 / (n -1) 必定是公差,而对于我们要判断的原数列,其最后一位 - 第一位数的值是可以-2,-1,0,+1,+2的,穷举可能性一切公差,找出变动最小的情况.代码如下(有点小复杂,没优化): #incl…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output As behooves any intelligent schoolboy, Kevin Sun is studying psycowlogy, cowculus, and cryptcowgraphy at the Bovinia State University (BGU) under…
Description \(x=a_1k+b_1=a_2l+b_2,L\leqslant x \leqslant R\) 求满足这样条件的 \(x\) 的个数. Sol 扩展欧几里得+中国剩余定理. 发现这个相当于一个线性方程组. \(x \equiv b_1(mod a_1)\) \(x \equiv b_2(mod a_2)\) 将原来两式相减得到 \(a_1k-a_2l=b_2-b_1\) 这个用扩展欧几里得求一下,如果 \((a_1,a_2)\nmid  (b_2-b_1)\) 显然无解…
贪心 A - Guest From the Past 先买塑料和先买玻璃两者取最大值 #include <bits/stdc++.h> typedef long long ll; int main(void) { ll n, a, b, c; std::cin >> n >> a >> b >> c; ll ans = 0; if (n >= a) { ll cnt1 = n / a; ll res = n % a; if (res >…
除夕夜之有生之年CF第一场 下午从奶奶家回到姥姥家,一看还有些时间,先吃点水果陪姥姥姥爷聊了会儿,再一看表,5:20....woc已经开场20分钟了...于是抓紧时间乱搞.. **A. Guest From the Past** time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Kolya Gerasimov loves kefi…
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic progressions: a1k + b1 and a2l + b2. Find the number of integers x such that L ≤ x ≤ R andx = a1k' + b1 = a2l' + b2, for some integers k', l' ≥ 0. 输入 Th…