Codeforces Round #240 (Div. 2) B 好题】的更多相关文章

B. Mashmokh and Tokens time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Bimokh is Mashmokh's boss. For the following n days he decided to pay to his workers in a new way. At the beginning of…
Codeforces Round #609 (Div. 2)前五题题解 补题补题…… C题写挂了好几个次,最后一题看了好久题解才懂……我太迟钝了…… 然后因为longlong调了半个小时…… A.Equation 题目大意:有一个数字n,让你给出任意两个合数a,b满足a - b = n. 我们知道大于2的偶数都是合数,那么如果n为奇数,只要n加上一个奇数合数一定也为合数,如果n为偶数,那么n加上一个偶数合数也一定为合数. 因为只求任意一组,就直接选择4,9,若为奇数输出 +n 和9,偶数输出 +…
点我看题目 A. Mashmokh and Lights time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard output Mashmokh works in a factory. At the end of each day he must turn off all of the lights. The lights on the factory a…
http://codeforces.com/problemset/problem/556/A 题意:给一个01字符串,把所有相邻的0和1去掉,问还剩下几个0和1. 题解:统计所有的0有多少个,1有多少个,最后答案就是两者不同的个数. #include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <algo…
A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output At regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. Afte…
A题和B题...   A. Saitama Destroys Hotel time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to opera…
A - Elections 题意: 每一场城市选举的结果,第一关键字是票数(降序),第二关键字是序号(升序),第一位获得胜利. 最后的选举结果,第一关键字是获胜城市数(降序),第二关键字是序号(升序),第一位获得胜利. 求最后选举获胜者. 思路: 直接模拟就可以. 代码: /* * @author FreeWifi_novicer * language : C++/C */ #include<cstdio> #include<iostream> #include<cstrin…
, a2, ..., an such that his boss will score exactly k points. Also Mashmokh can't memorize too huge numbers. Therefore each of these integers must be at most 109. Input The first line of input contains two space-separated integers n, k (1 ≤ n ≤ 105; …
A: 1分钟题,往后扫一遍 int a[MAXN]; int vis[MAXN]; int main(){ int n,m; cin>>n>>m; MEM(vis,); ; i <= m ; i++) { cin>>a[i]; for(int j = a[i] ; j <= n ; j++){ ){ vis[j] = a[i]; } } } ; i <= n ; i++){ cout<<vis[i]<<" "…
A题 题意:给你 n 个数 , 你需要改变这些数使得这 n 个数的值相等 , 并且要求改变后所有数的和需大于等于原来的所有数字的和 , 然后输出满足题意且改变后最小的数值. AC代码: #include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int _; cin>>_; while(_--){ int n; cin>>n; ]; ; ;i<=n;i++){…
A题 题意:给你 n 个数 , 你需要改变这些数使得这 n 个数的值相等 , 并且要求改变后所有数的和需大于等于原来的所有数字的和 , 然后输出满足题意且改变后最小的数值. AC代码: #include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int _; cin>>_; while(_--){ int n; cin>>n; ]; ; ;i<=n;i++){…
难题不会啊…… 我感觉写这个的原因就是因为……无聊要给大家翻译题面 A. Maximum Square 简单题意: 有$n$条长为$a_i$,宽为1的木板,现在你可以随便抽几个拼在一起,然后你要从这一大块木板中裁出一块最大的正方形. $1 \leq a_i \leq n \leq 1000$ 多测,$T \leq 10$ 给个官网的图: 直接排序然后扫就行了,这数据范围是不是让你想什么神奇东西了? #include <algorithm> #include <iostream> #…
---恢复内容开始--- output standard output The final match of the Berland Football Cup has been held recently. The referee has shown n yellow cards throughout the match. At the beginning of the match there were a_1 players in the first team and a_2 players…
E:https://codeforces.com/contest/1088/problem/E dp+贪心 题目大意:选择一个k并且选择k个连通块,要求sigma a[i]/k最大,k尽量大,对于给定的一颗树,输出最大的分数,不用约分的形式.题目意思需要进一步解析,假定有一个最大的连通块,那么根据贪心的思想,肯定是选择这个连通块,但又要求k大,所以把所有大小为这个连通块的dp值都计数一遍,因为我们知道两个最大的连通块不可能有交集,如果有,肯定是交集部分就是最大值部分,其余的部分都是零,那么我们从…
A. Mashmokh and Lights time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mashmokh works in a factory. At the end of each day he must turn off all of the lights. The lights on the factory are…
A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at…
Problem A:题目传送门 题目大意:给你N家店,每家店有不同的价格卖苹果,ai元bi斤,那么这家的苹果就是ai/bi元一斤,你要买M斤,问最少花多少元. 题解:贪心,找最小的ai/bi. #include <cstdio> using namespace std; double minn=2e9,x,y,M; int N; int read() { '); +c-'; return x; } inline double min(double x,double y){return x<…
Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tas…
B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inv…
                                             B. Mashmokh and ACM                                                                                             time limit per test 1 second                                                                …
, b2, ..., bl (1 ≤ b1 ≤ b2 ≤ ... ≤ bl ≤ n) is called good if each number divides (without a remainder) by the next number in the sequence. More formally  for all i (1 ≤ i ≤ l - 1). Given n and k find the number of good sequences of length k. As the a…
思路:x,y,z肯定不为负数xw+dy=p,直接枚举系数较小的y即可,y的范围:y<w,因为大于w的时候,不如去增加x,这样x+y的和还能保持尽可能小. /* x*w+y*d=p; x*w+(Kw+y)*d (x+d)*w+d; x+y+z=n; */ #include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int n,p,w,d;cin>>n>>p>…
Codeforces Round #182 (Div. 1)题解 A题:Yaroslav and Sequence1 题意: 给你\(2*n+1\)个元素,你每次可以进行无数种操作,每次操作必须选择其中n个元素改变符号,你的目的是使得最后所有数的和尽量大,问你答案是多少 题解: 感觉上就是构造题,手动玩一玩就知道,当n为奇数的时候,你可以通过三次操作,使得只会改变一个负数的符号.同理n为偶数的时候,每次要改变两个负数的符号. 所以答案如下: 当n为奇数的时候,答案为所有数的绝对值和 当n为偶数的…
题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> #include <iostream> #include <cstring> #include <string> #include <algorithm> using namespace std; ; const int INF = 0x3f3f3f3f;…
题目地址 先简单的总结一下这次CF,前两道题非常的水,可是第一题又是因为自己想的不够周到而被Hack了一次(或许也应该感谢这个hack我的人,使我没有最后在赛后测试中WA).做到C题时看到题目情况非常复杂,明显超出自己现在水平,卡了很久也没有好好做题.等了很长时间才开始看D题,而这时信心已经严重不足.赛后再看D题才发现自己比赛时理解错了题意,致使误以为题目非常复杂.而实际上,这个过程分析起来是非常容易的. 对于三种棱长度分别为a,b,c的石头,r最大为min(a,b,c)/2;. 如果两个石头要…
Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to becom…
Problem   Codeforces Round #539 (Div. 2) - C. Sasha and a Bit of Relax Time Limit: 2000 mSec Problem Description Input The first line contains one integer n (2≤n≤3⋅10^5) — the size of the array. The second line contains n integers a1,a2,…,an (0≤ai<2^…
题目传送门 /* 很简单的水题,晚上累了,刷刷水题开心一下:) */ #include <bits/stdc++.h> using namespace std; ][] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight",…
题目传送门 /* 水题:ans = (1+2+3+...+n) * k - n,开long long */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; typedef long long ll; int main(void) //Codeforces Round #304 (Div. 2) A. Soldier…
题目传送门 /* 题意:5种情况对应对应第i或j辆车翻了没 水题:其实就看对角线的上半边就可以了,vis判断,可惜WA了一次 3: if both cars turned over during the collision. 是指i,j两辆车,而不是全部 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <iostream>…