TAT 第一场codeforces B. Array Walk #暴力 #贪心 题目链接 题意 有\(a1, a2, ..., an\) 个格子(每个格子有各自分数),最初为1号格(初始分数为\(a1\)),支持两种走法(经过的格子分数会相应累加),只能走\(k\)步:①向右走.②向左走,但是每一次向左操作走完一格后不能再连续地向左移动,允许向左走的操作次数为\(z\).现要求你走完k次后获得的最大分数. 分析 参考了官方题解,假定我们有\(t\)次移动是向左的,那么剩下\(k-t\)次向右,我…
A.LCM Problem 题意:最小公倍数LCM(x,y),处于[l,r]之间,并且x,y也处于[l,r]之间,给出l,r找出x,y; 思路:里面最小的最小公倍数就是基于l左端点的,而那个最小公倍数就是2*l,直接判断2*l是否小于r 注意:当时看到最小公倍数,题目中提到了一个LCM(9,6)=18,就只想最大公因子.分解因式之类的问题,就想错了方向,wa的第一个是想的最大的数分解因式,结果TLE了. 1 #include<iostream> 2 #include<algorithm&…
D. Stressful Training 题目链接:https://codeforces.com/contest/1132/problem/D 题意: 有n台电脑,每台电脑都有初始电量ai,也有一个耗电量bi,意即每1s耗电多少,现在你有一个充电器,它每s可以给一台电脑充x的点亮. 问x最少为多少,可以让所有电脑直至k时刻,点亮都不小于0. 题解: 我们考虑贪心,先给最需要充电的电脑充电,然后二分答案x去检验.大概思路就是这样吧...但是实现起来还是有点困难. 首先处理出每个电脑最晚需要充电的…
链接:https://codeforces.com/contest/1295 A. Display The Number 贪心思路,尽可能放置更多位,如果n为奇数,消耗3去放置一个7,剩下的放1 AC代码: #include<bits/stdc++.h> #define inf 0x3f3f3f3f using namespace std; int n,m; int main(){ int t; cin>>t; while(t--){ int n; cin>>n; st…
Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec Problem Description Input Output The only line should contain the minimal number of days required for the ship to reach the point (x2,y2)(x2,y2). If it…
Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec Problem Description Input The input contains a single line consisting of 2 integers N and M (1≤N≤10^18, 2≤M≤100). Output Print one integer, the total n…
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define IT set<ll>::iterator #define sqr(x)…
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define IT set<ll>::iterator #define sqr(…
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://codeforces.com/contest/985/problem/F Description You are given a string s of length n consisting of lowercase English letters. For two given strings s an…
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://codeforces.com/contest/985/problem/E Description Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome w…